I had the wrong idea of how to create a repository. I created a single repository for each Entity that would CRUD using an ORM, which worked very well. However, I needed more and didn't know how to do it without messing up my existing code.
I wanted to add filtering based on Logins. I eventually found Castle.Windsor references showing something like this:
var ControllerContactRepo = new SecurityContactRepo( new ContactRepo() );
Where the Controller in MVC accesses one repository for Contacts which handles both CRUD and security without the controller knowing it. I presume the POCOs passed between repositories change based on the Liskov substitution principle, and the repositories are done with the decorator design pattern?
Whe开发者_开发知识库re can I see some C# examples of this technique before I jump head first in to Castle Windsor? I am familiar with Constructor based IoC but not so much DI. I really want to know the nuts and bolts of this technique before I abstract it away with Windsor.
Links to website tutorials would be great, or book suggestions.
Here is a good article for you http://huyrua.wordpress.com/2010/07/13/entity-framework-4-poco-repository-and-specification-pattern/
精彩评论