Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            // Identity
            services.AddDbContext <SecurityContext>(options =>
                                                    options.UseNpgsql(Configuration.GetConnectionString("Default"),
                                                                      x => x.MigrationsHistoryTable("__MigrationsHistory", SecurityContext.DEFAULT_SCHEMA)));

            IdentityHelper.ConfigureService(services);

            // Helpers
            AuthenticationHelper.ConfigureService(services, Configuration["JwtSecurityToken:Issuer"], Configuration["JwtSecurityToken:Audience"], Configuration["JwtSecurityToken:Key"]);
            CorsHelper.ConfigureService(services);
            SwaggerHelper.ConfigureService(services);

            // Settings
            services.Configure <EmailSettings>(Configuration.GetSection("Email"));
            services.Configure <ClientAppSettings>(Configuration.GetSection("ClientApp"));
            services.Configure <JwtSecurityTokenSettings>(Configuration.GetSection("JwtSecurityToken"));
            services.Configure <QRCodeSettings>(Configuration.GetSection("QRCode"));

            // Services
            services.AddTransient <IEmailService, EmailService>();

            // Azure
            // Azure Storage Services
            services.AddScoped <IBlobStorage>(s => new BlobStorage(Configuration["ConnectionStrings:AzureStorage"], Configuration["AzureStorage:ContainerName"], Configuration["AzureStorage:Url"]));
            services.AddScoped <IQueueStorage>(s => new QueueStorage(Configuration["ConnectionStrings:AzureStorage"]));

            // Data
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            HttpClientHelper.ConfigureService(services, Configuration);
            DataDependencyLoader.ConfigureService(services);
            DomainDependencyLoader.ConfigureService(services);
            SwaggerHelper.ConfigureService(services);

            /*services.AddCors(options =>
             * {
             *  options.AddPolicy("default", builder =>
             *  {
             *      builder.
             *  });
             * })*/
        }
Exemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddDbContext <CitasContext>(options =>
                                                 options.UseNpgsql(Configuration.GetConnectionString("Default"),
                                                                   x => x.MigrationsHistoryTable("__MigrationsHistory", CitasContext.DEFAULT_SCHEMA)));

            SwaggerHelper.ConfigureService(services);

            services
            .AddCustomMvc()
            .AddCustomIntegrations(Configuration)
            .AddCustomConfiguration(Configuration);

            services.AddControllersWithViews()
            .AddNewtonsoftJson(options =>
                               options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                               );
        }
Exemplo n.º 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //https://github.com/shammelburg/CoreIdentity
            // Identity
            services.AddDbContext <Api.Identity.SecurityContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"]));
            // Tools->NuGet Package Manager -> Package Manager Console
            // Initialise
            // add-migration init -Context SecurityContext
            // update or create DB
            // update-database -Context SecurityContext
            IdentityHelper.ConfigureService(services);

            // Helpers
            AuthenticationHelper.ConfigureService(services, Configuration["JwtSecurityToken:Issuer"], Configuration["JwtSecurityToken:Audience"], Configuration["JwtSecurityToken:Key"]);
            CorsHelper.ConfigureService(services);
            SwaggerHelper.ConfigureService(services);

            // Settings
            services.Configure <EmailSettings>(Configuration.GetSection("Email"));
            services.Configure <ClientAppSettings>(Configuration.GetSection("ClientApp"));
            services.Configure <JwtSecurityTokenSettings>(Configuration.GetSection("JwtSecurityToken"));
            //services.Configure<QRCodeSettings>(Configuration.GetSection("QRCode"));

            // Services
            services.AddTransient <IEmailService, EmailService>();
            services.AddScoped(typeof(IGenericRepository <>), typeof(GenericRepository <>));
            services.AddTransient <IUnitOfWork, UnitOfWork>();

            services.AddControllers();
            services.AddHttpContextAccessor();

            // Mapper
            services.AddAutoMapper(typeof(AutoMapping));

            //Define upload
            services.Configure <FormOptions>(o => {
                o.ValueLengthLimit         = int.MaxValue;
                o.MultipartBodyLengthLimit = int.MaxValue;
                o.MemoryBufferThreshold    = int.MaxValue;
            });
        }
Exemplo n.º 5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Identity
            services.AddDbContext <SecurityContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:Default"]));

            // Tools->NuGet Package Manager -> Package Manager Console
            // Initialise
            // add-migration init -Context SecurityContext
            // update or create DB
            // update-database -Context SecurityContext
            IdentityHelper.ConfigureService(services);

            // Helpers
            AuthenticationHelper.ConfigureService(services, Configuration["JwtSecurityToken:Issuer"], Configuration["JwtSecurityToken:Audience"], Configuration["JwtSecurityToken:Key"]);
            CorsHelper.ConfigureService(services);
            SwaggerHelper.ConfigureService(services);

            // Settings
            services.Configure <EmailSettings>(Configuration.GetSection("Email"));
            services.Configure <ClientAppSettings>(Configuration.GetSection("ClientApp"));
            services.Configure <JwtSecurityTokenSettings>(Configuration.GetSection("JwtSecurityToken"));
            services.Configure <QRCodeSettings>(Configuration.GetSection("QRCode"));

            // Services
            services.AddTransient <IEmailService, EmailService>();

            // Azure
            // Azure Storage Services
            services.AddScoped <IBlobStorage>(s => new BlobStorage(Configuration["ConnectionStrings:AzureStorage"], Configuration["AzureStorage:ContainerName"], Configuration["AzureStorage:Url"]));
            services.AddScoped <IQueueStorage>(s => new QueueStorage(Configuration["ConnectionStrings:AzureStorage"]));

            // Data
            services.AddDbContextPool <DataContext>(options => options.UseSqlServer(Configuration["ConnectionStrings:Default"]));
            services.AddScoped <IExampleRepo, ExampleRepo>();

            services.AddControllers();
        }