Tutorial :How to give access restriction to DLL's in .net


I have a 3 layer application(UI,Business Layer,Data Layer).My requirement is my datalayer should be only accessible by business layer,and the business layer should be only accessible by UI layer.

That means even if i add a reference of adtalayer in the UI layer,it should not be able to access the methods in Datalayer.

I should be able to create DLL's with access protection.

please suggest a solution for this?




You can mark the constructors of key classes or methods in your business and data layers as internal and then use the InternalVisibleTo attribute to extend that access to the appropriate assemblies.


Sounds to me like what you're looking for is called "policy injection". I'm not sure if this is the easiest or best way, but PostSharp will do what you want.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »