コード例 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddCors();
            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Star Wars Api", Version = "v1"
                });
            });
            services.AddJwt();

            var builder = new ContainerBuilder();

            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .AsImplementedInterfaces();

            InfrastructureContainer.Build(builder, Configuration);
            ServiceContainer.Build(builder);

            builder.Populate(services);
            Container = builder.Build();

            return(new AutofacServiceProvider(Container));
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: Cule5/TaskManager
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            var builder = new ContainerBuilder();

            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .AsImplementedInterfaces();

            InfrastructureContainer.Build(builder);
            ServiceContainer.Build(builder);

            builder.Populate(services);
            Container = builder.Build();

            return(new AutofacServiceProvider(Container));
        }