有没有一种方法可以设置两个 C#.Net 项目相互信任?
我在单个解决方案 ModelProject 和 PluginProject 中有两个 C#.NET 项目。 PlugInProject 是另一个应用程序的插件,因此引用其 API。 PlugInProject 用于从其插入的应用程序中提取数据。 ModelProject 包含由 PlugInProject 提取的类的数据模型。
提取的数据可以独立于应用程序或插件使用,这就是我将 PlugInProject 与 ModelProject 分开的原因。我希望 ModelProject 保持独立于 PlugInProject 和应用程序 API。或者换句话说,我希望有人能够访问提取的数据,而无需访问 PlugInProject、应用程序或应用程序的 API。
我遇到的问题是 PlugInProject 需要能够在 ModelProject 中创建和修改类。但是,我不想向使用 ModelProject 的任何人公开这些操作。提取的数据实际上应该是只读的,除非稍后由 PlugInProject 修改。
如何将这些项目分开,但给予 PlugInProject 对 ModelProject 的独占访问权限?这可能吗?
I have two C#.NET projects in a single solution ModelProject and PluginProject. PlugInProject is a plug-in for another application, and consequently references its API. PlugInProject is used to extract data from the application it plugs into. ModelProject contains the data model of classes that are extracted by PlugInProject.
The extracted data can be used independent of the application or the plug-in, which is why I am keeping PlugInProject separate from ModelProject. I want ModelProject to remain independent of PlugInProject, and the Applications API. Or in other words I want someone to be able to access the extracted data without needing access to PlugInProject, the application, or the application's API.
The problem I'm running into though is PlugInProject needs to be able to create and modify classes in ModelProject. However, I'd prefer to not make these actions public to anyone using ModelProject. The extracted data should effectively be read-only, unless later modified by PlugInProject.
How can I keep these projects separate but give PlugInProject exclusive access to ModelProject? Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以定义修改 ModelProject 对象内部的方法,以便使用 ModelProject 的其他项目将无法调用这些方法,然后使用 InternalsVisibleToAttribute 授予 PlugInProject 对 ModelProject 内部方法的访问权限。
You could define the methods to modify ModelProject objects internal, so that other projects using ModelProject will not be able to call those methods, then use the InternalsVisibleToAttribute to grant PlugInProject access to the internal methods of ModelProject.
可以使用继承来扩展 ModelProject 中的类吗?
Can you use inheritance to extend classes in ModelProject?