Esempio n. 1
0
        public void Setup()
        {
            var scalableDbContext = new ScalableDbContext(Assembly.GetExecutingAssembly(), "EFDataAccess");

            _repository = new GenericRepository(scalableDbContext);
        }
Esempio n. 2
0
        public static void  MarketPlace(UnityContainer unityContainer)
        {
            unityContainer.RegisterType <IProductService, ProductService>();
            unityContainer.RegisterType <IRepository, GenericRepository>();

            //I have used EntityFramework in my code and following line is quite handy to tell container to use same instance of DbContent for an object graph
            unityContainer.RegisterType <DbContext>(new PerResolveLifetimeManager(), new InjectionFactory(c => ScalableDbContext.Create("EF.Mapper.dll", "EFTest")));
        }