I need to inject generic repositories (IRepository) into my classes’ constructors but I dont know how to do it with the new DSL in structuremap 2.6, does anyone know how?
I need to inject generic repositories (IRepository) into my classes’ constructors but I dont
Share
This can be done with just one line of code in your configuration. Assuming you have this:
Entities:
– Customer
– Order
And have a generic repository model like this:
And have a app services that look like:
You would have something like this. Notice the bit about using the scanner to hook up your custom repositories.
Assuming your Repositories are defined in some other assembly from your application, you can use Registries to hook it all together. Check out this post:
http://blog.coreycoogan.com/2010/05/24/using-structuremap-to-configure-applications-and-components/