开发者

Is there a way to set two C#.Net projects to trust one another?

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 s开发者_JS百科omeone 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?


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.


Can you use inheritance to extend classes in ModelProject?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜