Beispiel #1
0
        public static WebMotorsContext GetInstance()
        {
            var optionsBuilder = new DbContextOptionsBuilder <WebMotorsContext>();

            optionsBuilder.UseSqlServer(SettingsDefault.connectionString());

            return(new WebMotorsContext(optionsBuilder.Options));
        }
Beispiel #2
0
        public static void ConfigureService(IServiceCollection services)
        {
            var stringConexaoComBancoDeDados = SettingsDefault.connectionString();

            services.AddDbContext <WebMotorsContext>(options =>
                                                     options.UseSqlServer(stringConexaoComBancoDeDados).EnableSensitiveDataLogging());

            services.AddScoped <IDbContext, WebMotorsContext>();
        }