Ejemplo 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.AddMvc();
     ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);
     CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
     ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);
 }
Ejemplo n.º 2
0
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            //Auto Mapper Configurations
            services.AddSingleton(provider => new MapperConfiguration(mc =>
            {
                mc.AddProfile(new DtoToSchemaMappingProfile());
                mc.AddProfile(new SchemaToDtoMappingProfile());
                mc.AddProfile(new DtoToResultMappingProfile());
                mc.AddProfile(new ModelToDtoMappingProfile());
            }).CreateMapper());

            // Add Hangfire services
            services.AddHangfire(Configuration.GetConnectionString("HangfireConnection"));
        }
Ejemplo n.º 3
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);
     AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
     CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
     ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);
     services.AddControllers().AddNewtonsoftJson(options =>
                                                 options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                                 );
     services.AddControllers();
     services.AddSwaggerGen(c =>
     {
         c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo {
             Title = "My API", Version = "v1"
         });
     }
                            );
 }
Ejemplo n.º 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            services
            .AddControllersWithViews()
            .AddNewtonsoftJson(options =>
                               options.SerializerSettings.Converters.Add(new StringEnumConverter()));

            services.AddHangfire(config =>
            {
                config.UsePostgreSqlStorage(Configuration.GetConnectionString("ReactConnectionString"));
            });

            services.AddSwaggerGen(
                c =>
            {
                c.SwaggerDoc(
                    "v5",
                    new OpenApiInfo
                {
                    Title       = "Glotech React API",
                    Version     = "v5",
                    Description = "ASP.NET Core Web API",
                    Contact     = new OpenApiContact
                    {
                        Name  = "Nguyen Dinh Binh",
                        Email = "*****@*****.**",
                    },
                    License = new OpenApiLicense
                    {
                        Name = "Copyright by Binh Nguyen",
                    }
                });

                c.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.HttpMethod}");
                var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                c.IncludeXmlComments(xmlPath);
            });
        }
Ejemplo n.º 5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(
                c =>
            {
                c.DescribeAllEnumsAsStrings();
                c.SwaggerDoc(
                    "v1",
                    new Info
                {
                    Title          = "Wedding.PROJECT API",
                    Version        = "v1",
                    Description    = "ASP.NET Core Web API 2",
                    TermsOfService = "None",
                    Contact        = new Contact
                    {
                        Name  = "Bui Thi Ngoc Phuc",
                        Email = "*****@*****.**",
                        Url   = "*****@*****.**"
                    },
                    License = new License
                    {
                        Name = "Copyright by The 41 Wedding Team",
                        Url  = ""
                    }
                });

                c.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.HttpMethod}");

                var filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "Wedding.WebApi.xml");
                c.IncludeXmlComments(filePath);
            });

            services.AddSignalR();
        }
Ejemplo n.º 6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            CoreServicesInstaller.ConfigureCoreServices(services, Configuration);
            AuthServicesInstaller.ConfigureServicesAuth(services, Configuration);
            ApplicationServicesInstaller.ConfigureApplicationServices(services, Configuration);

            ServiceLocator.SetLocatorProvider(services.BuildServiceProvider);

            services.AddMvcCore()
            .AddApiExplorer();

            // Add the embedded file provider
            var viewAssembly = typeof(RazorViewRenderService).GetTypeInfo().Assembly;
            var fileProvider = new EmbeddedFileProvider(viewAssembly);

            services.Configure <RazorViewEngineOptions>(
                options =>
            {
                options.FileProviders.Add(fileProvider);
            });

            services.AddHangfire(
                config =>
                config.UseSqlServerStorage(Configuration["ConnectionStrings:ErpConnection"]));

            services.Configure <FormOptions>(options =>
            {
                options.MultipartBodyLengthLimit = 52428800;
            });

            // Register the Swagger generator, defining one or more Swagger documents
            services.AddSwaggerGen(
                c =>
            {
                c.EnableAnnotations();
                c.DescribeAllEnumsAsStrings();
                c.SwaggerDoc(
                    "v1",
                    new Info
                {
                    Title          = "HAWA API",
                    Version        = "v1",
                    Description    = "ASP.NET Core Web API 2",
                    TermsOfService = "None",
                    Contact        = new Contact
                    {
                        Name  = "Nguyen Khanh Huy",
                        Email = "*****@*****.**",
                        Url   = "*****@*****.**"
                    },
                    License = new License
                    {
                        Name = "Copyright by BYS JSC",
                        Url  = "https://wwww.bys.vn"
                    }
                });

                c.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.HttpMethod}");

                var filePath = Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "HawaDDS.xml");
                c.IncludeXmlComments(filePath);
            });
        }