Any assembly can use any public type of other assemblies. There is no way of
restricting this. If a type is public it can be used. However access to
internal types is limited only withing the assembly itself.
..NET 2.0 extends their visiblity by introducing *friend assemblies*, so the
internal types and members are visible inside the assembly and in all
assemblies that the declaring assembly define as *friends*. So there is
probably your solution. Declare all the types (or at least the ones that you
don't want to be shared with everybody) as internal and let the legacy
assembly declare the datalayer as *firend*. The downside of this that the
datalayer will see everything even types and members that are internal
implementation.
For declaring *friend assemblies* look at MSDN
http://msdn2.microsoft.com/en-us/library/0tke9fxk.aspx
Read carefully because there are some requirements to use that feature; they
even can make it inaplicable with your project. Keep in mind also that this
feature is not available in .NET 1.x
--
HTH
Stoitcho Goutsev (100)
Can a project or assembly limit the projects that may reference it?
For example, I have a legacy project used by a data layer project. I
don't want the object model project to be able to directly access the
legacy project. The object model or business logic project should only
be allowed to reference the data layer project.
Thanks,
Ché