Example #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            string connection = Configuration.GetConnectionString("DataSource");

            DataModule.Configure(services, connection);

            services.AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
            .AddJsonOptions(option =>
            {
                option.SerializerSettings.Converters.Add(new WebApiExampleDateTimeConverter());
                option.SerializerSettings.Converters.Add(new StringEnumConverter());
            });

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info {
                    Title = "Web Api Example", Version = "v1"
                });
            });
        }