Register Repository Implementations Automatically with Windsor(nathan.whiteboard-it.com)

submitted by nrstottnrstott(345) 2 years, 11 months ago

It is common in a domain driven design project to want to register all the implementations of IRepository<> by convention. There may be interfaces that inherit from IRepository<> such as ICustomerRepository inheriting from IRepository<Customer>. This article provides a Castle Facility that takes as its configuration parameters the base type of the repository (IRepository<>) and a group of assemblies to search. It registers implementations of the IRepository interfaces both for the generic type and for the more specific type. You would therefore be able to, in our example, retrieve CustomerRepository (implementation of ICustomerRepository) by resolving IRepository<Customer> or ICustomerRepository. If you practice DDD and are using Windsor as your Inversion of Control container, this may be useful to you. If you use a different inversion of control container, the approach could be adapted to your needs.

add a comment |category: |Views: 34

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story