如何在插件之间来回传递未知结构的数据
我正在创建一个插件架构,它有一个主程序可以识别的名为 IIndividual
的公共记录。但是,我想将 IIndividual 记录传递给插件,向其中添加特定于插件的数据,然后将带有附加数据的 IIndividual 记录传递回主程序并显示所有字段。
正如问题所暗示的,每个插件中的附加数据都是不同的,因此在 CommonKey 之外没有可以使用的通用接口。
public interface IIndividual
{
public IIndividual GetRecord(int id);
public IEnumerable<IFunction> PluginOperations();
public ? GetCompleteRecord();
}
我的第一个想法是使用 XML 格式,问题是我确实得到了强类型变量,如果我想做的不仅仅是显示,这可能是一个问题。
第二个想法是拥有一系列 IIdividual 可以继承的子组件接口。但这会导致非通用架构的问题。
I am creating a plugin architecture that has a common record called IIndividual
that the main program recognizes. However, I want to pass an IIndividual record to the plugin, add data to it specific to the plugin, then pass the IIndividual record with the appended data back to the main program and display all the fields.
As the question implies, the appended data in each plugin is different, so there isn't a common interface I can use outside of the CommonKey.
public interface IIndividual
{
public IIndividual GetRecord(int id);
public IEnumerable<IFunction> PluginOperations();
public ? GetCompleteRecord();
}
My First thought was to use an XML format, the issue with that is that I do get strongly typed variables which might be an issiue if I want to do more than display.
Second thougt was to have a series of sub component interfaces that IIdividual might inherit from. But that will cause the issue of non generic architecture.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如@Neil所说。让插件返回它自己的视图来显示和使用是理想的解决方案。
As @Neil said. Having the Plugin Return it's own view to be displayed and work with is the ideal solution.