public DataContext CreateDbContext(string[] args)
        {
            string connectionString = AppConfigs.GetDbConnectionString();

            var dbContextOptionsBuilder = new DbContextOptionsBuilder <DataContext>();

            dbContextOptionsBuilder.UseSqlServer(connectionString);

            DbContextOptions <DataContext> dbContextOptions = dbContextOptionsBuilder.Options;

            return(new DataContext(dbContextOptions));
        }
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy(ALLOWED_ORIGIN_POLICY,
                                  builder =>
                {
                    builder.AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowAnyOrigin();
                });
            });

            services.AddControllers()
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ContractResolver               = new CamelCasePropertyNamesContractResolver();
                options.SerializerSettings.DefaultValueHandling           = DefaultValueHandling.Include;
                options.SerializerSettings.StringEscapeHandling           = StringEscapeHandling.Default;
                options.SerializerSettings.TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Full;
                options.SerializerSettings.DateTimeZoneHandling           = DateTimeZoneHandling.Utc;
                options.SerializerSettings.DateFormatHandling             = DateFormatHandling.IsoDateFormat;
                options.SerializerSettings.ConstructorHandling            = ConstructorHandling.AllowNonPublicDefaultConstructor;
            })
            .AddApplicationPart(typeof(HomeController).Assembly);


            services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo()); });


            string connectionString = AppConfigs.GetDbConnectionString();

            services.AddDbContext <DataContext>((provider, builder) =>
            {
                var loggerFactory = provider.GetService <ILoggerFactory>();
                builder.UseLoggerFactory(loggerFactory)
                .EnableSensitiveDataLogging()
                .UseSqlServer(connectionString);
            });
            services.AddScoped <IUserRepository, UserRepository>();
        }