c# - Convert unity to autofac -


i trying convert example piece of code found on caching repository. problem it's using unity di , don't have understanding how works.

public interface iunitofwork : idisposable {     irepository<blog> blogrepository { get; }     task<int> savechangesasync(); }  public class unitofwork : iunitofwork {     private idatastorecontext datastorecontext;      private readonly iunitycontainer container;      public irepository<blog> blogrepository     {                 {             // todo : use unity containers generate unitofwork make surethat             // datacontext single instance in instance of uow             return new genericrepository<blog>(                 this.container.resolve<icachestrategy<blog>>(),                 new sqldatastorestrategy<blog>(this.datastorecontext));         }     }       public unitofwork(idatastorecontext datastorecontext, iunitycontainer container)     {         this.datastorecontext = datastorecontext;         this.container = container;     }      public async task<int> savechangesasync()     {         return await this.datastorecontext.savechangesasync();     }      public void dispose()     {         this.datastorecontext.dispose();     } } 

can point me in right direction on how should write autofac statement?

i have ever need use basic autofac e.g.

    var builder = new containerbuilder();          // create container , use default application services fallback         autofacregistration.populate(builder, services);          builder.register(c => new logger())              .as<ilogger>()              .instanceperlifetimescope(); 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -