예제 #1
0
        // ConfigureContainer is where you can register things directly
        // with Autofac. This runs after ConfigureServices so the things
        // here will override registrations made in ConfigureServices.
        // Don't build the container; that gets done for you by the factory.
        public void ConfigureContainer(ContainerBuilder builder)
        {
            // Register your own things directly with Autofac, like:

            if (IocHttp)
            {
                builder.RegisterType <HttpContextAccessor>()
                .As <IHttpContextAccessor>()
                .SingleInstance();
            }


            // register automapper....

            builder.RegisterAutoMapper(typeof(Startup).Assembly);


            builder.RegisterType <AppUser>().As <IAppUser>();                                 // (IocHttp);
            builder.RegisterType <CoursePlatformContext>().As <ICoursePlatformHttpContext>(); // (IocHttp);
            builder.RegisterType <UserHub>().As <IUserHub>();

            builder.AddApiAsset(() => Configuration.GetSection(ApiOptions.SectionName).Get <ApiOptions>());

            //builder.Reg<CourseSubscriber, ISubscriberService>();

            builder.AddDomain(this.IocHttp, Configuration);
        }
예제 #2
0
        // ConfigureContainer is where you can register things directly
        // with Autofac. This runs after ConfigureServices so the things
        // here will override registrations made in ConfigureServices.
        // Don't build the container; that gets done for you by the factory.
        public void ConfigureContainer(ContainerBuilder builder)
        {
            // Register your own things directly with Autofac, like:

            if (IocHttp)
            {
                builder.RegisterType <HttpContextAccessor>()
                .As <IHttpContextAccessor>()
                .SingleInstance();
            }
            builder.Reg <AppUser, IAppUser>(IocHttp);
            builder.Reg <NotesContext, INotesHttpContext>(IocHttp);
            builder.Reg <QueryBridge, IQueryBridge>(IocHttp);
            builder.Reg <EntryFromD4L, IEntry>(IocHttp);

            builder.AddApiAsset(() => Configuration.GetSection(ApiOptions.SectionName).Get <ApiOptions>());

            builder.AddDomain(this.IocHttp, Configuration);
        }