开发者

Controlling Access to .NET Assemblies

I have a group of dlls for WCF services. The contain contracts, interfaces etc. I would like to reuse this code in the API (client side) but don't want the consumers of the API to use thes开发者_JAVA技巧e features.

Is there a way to say core.dll can only be used by clientcore.dll?


Well, you can give all the members of core.dll an access modifier of internal and then use InternalsVisibleToAttribute to give access to clientcore.dll.

To make life easier for your clients, you might actually want to merge core.dll into clientcore.dll using ILmerge. That way your callers don't need to copy a DLL they never use directly.


Yes, make your types internal and then use the friend assembly mechanism (via the InternalsVisibleToAttribute class).


sure, it's called:

Code Access Security

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜