The examples I can find use a two layer architecture, where the controllers directly use the repository classes in the data access layer. See here or here.
Where would you register components from the data access layer if you have a service or business logic layer that uses those components? The data access layer should ideally not be referenced from the user interface layer, right? So Application_Start would not be the right place to do it.
What would be a better way?
Thank you!
Something has to know about which implementations you want to use. There's typically 3 ways to accomplish this:
With Autofac you have a few choices
For #2 I would implement something like an IContainer interface so that your IoC framework is loosely coupled with your system. Then have your data access implemenations use that interface to registered the required components.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With