Hi Jeff,
You need to think twice about exposing low-level functionality through a high-level interface. The purpose of repositories is, in one respect, to hide low level functionality. If you feel that you need to do so then maybe you have problems with one or both of your interfaces. Some code examples would be useful to make further comment. That said, and after you clearly think through your design and you still want to proceed, then you may want to look at the assembly attribute "InternalsVisibleTo". This allows you to define internal classes and interfaces in one assembly and have them visible is other assemblies that you explicitly allow access via the "InternalsVisibleTo" attribute. It is very useful for unit testing. Again, I'd carefully think about your design first. I hope this helps. Cheers. James. From: [email protected] [mailto:[email protected]] On Behalf Of Jeff Sinclair Sent: Wednesday, 28 July 2010 21:15 To: 'ozDotNet' Subject: Dependency injection Hi, I am using Microsoft unity to do dependency inject but I have a small problem. Let's say I have a business layer assembly and a data layer assembly. The data layer exposes 2 interfaces, IDataRepositortyA and IDataRepositoryB. These are both constructed by unity. Now let's say IDataRepositoryA needs to do some low level calls to repository B, say for some type of mash-up. How do I expose a low level function on repository B that really should not be visible to the business layer. Do I just add the low level functions to the public IDataRepositoryB interface, which makes them visible to the business layer? Or do I create a new interface for the extra low level functions? If I make the new interface internal, how does it work with injection ? Jeff
