I write in-house software for a company.
I always want to leverage OOP techniques as best as I can. In this thinking, I want to create a Data Access Layer (DAL) isolated in its own .DLL
.
What can I do to limit the access of the DAL DLL
to only my business logic layer DLL
?
The last thing I need is someone in the company with a little programming knowledge plus access to the system (via Active Directory) to install .NET Express, reference my .DLL
, and start firing off data access code outside of the real system. Are there any .NET mechanisms I can employ to limit a DLL
to be used only by a pre-selected host application/DLL?
The easiest way to limit access from a code perspective is to use friend assemblies. You can make all of the types in your Data Access Layer DLL Friend / Internal. Then only add your Business Logic Layer components as friends and they will be able to use the types. Anyone else in the company will not since they don't have DLL's with internal access.
Documentation - http://msdn.microsoft.com/en-us/library/bb384772.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With