예제 #1
0
        public static void Configure()
        {
            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterType <PostRepository>().As <IRepositoryBase <AspNetPosts> >();
            builder.RegisterType <SocialMediaContext>().As <DbContext>();

            IContainer container = builder.Build();

            AutofacContainer.Initialize(container);
        }
        public static void Configure()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <NorthwindContext>().As <INorthwindContext>();
            builder.RegisterType <ProductRepository>().As <IProductRepository>();
            builder.RegisterType <ProductService>().As <IProductService>();
            builder.RegisterType <ProductViewModel>().As <IProductViewModel>();

            IContainer container = builder.Build();

            AutofacContainer.Initialize(container);
        }