Example #1
0
        public virtual void Configure(IDependencyContainer container)
        {
            Database.SetInitializer<IdentityDbContext>(null);

            container.RegisterPerRequest<IContext, Context>();
            container.RegisterPerRequest<DbContext, IdentityDbContext>(new Dictionary<String, Object> { { "nameOrConnectionString", ConfigurationManager.ConnectionStrings["mvcForum.DataProvider.MainDB"].ConnectionString } });

            container.RegisterGeneric(typeof(IRepository<>), typeof(Repository<>));

            // TODO: Do this in some other way!!
            new SpecificRepositoryConfiguration().Configure(container);

            //container.RegisterGenericPerRequest(typeof(IUserStore<ApplicationUser>), typeof(UserStore<ApplicationUser>));
            //container.RegisterGenericPerRequest(typeof(UserManager<ApplicationUser>), typeof(UserManager<ApplicationUser>));
            //container.RegisterGenericPerRequest(typeof(RoleManager<IdentityRole>), typeof(RoleManager<IdentityRole>));
        }