protected override void Load(ContainerBuilder builder) { builder.Register(c => { var db = new JimsStoreContext(_connStr); var rep = new Repository(db); return(rep); }).As <IRepository>().InstancePerLifetimeScope(); builder.Register(c => new StoreService(c.Resolve <IRepository>(), c.Resolve <IFileStorage>())).As <IStoreService>().InstancePerLifetimeScope(); builder.Register(c => new FileStorage(HttpContext.Current.Server.MapPath("~/images"), "images")).As <IFileStorage>().InstancePerLifetimeScope(); base.Load(builder); }
public Repository(JimsStoreContext context) { _context = context; }