inversion of control - Manage autofac container setup -


One of our team members has decided to use autofac on one of our services and we will try it Because we get stuck with it.

Now the time has passed and the container setup method has increased! It is so big that we have problems with it

We have not seen the results of splitting it. Maybe we're using it incorrectly

So my question is: How can we manage the container setup? Can we dump into XML or are there any other best practices?

There are several ways to manage container setup with AutoFac

The most common By using a module in the manner and registering it with the builder, you can break down many groups of registrations in this way:

  Public class dalmud: Module {Secure Override Zero Load (Containerbuilder Builder) {Builder. Registrar & lt; SomeDataSomething & gt; (). & Lt; IDataSomething & gt; ); Builder. Registration and lieutenant; Some other sishing (c = & some; OtherOtherSomething.Create ()); // and so on}}  

Then register these breakdown modules with the code or builder via XML. (A simple call to the builder. Registry Module (New Dalmodol ()) it will be here). See on the wiki page.

Or, you can only use XML files (or you can use XML and module) for this, see the wiki page.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -