public TypeBarangFacade() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); IConfigurationRoot configuration = builder.Build(); string connectionString = configuration.GetConnectionString("DefaultConnection").ToString(); var optionsBuilder = new DbContextOptionsBuilder <ljgbContext>(); optionsBuilder.UseSqlServer(connectionString); db = new ljgbContext(optionsBuilder.Options); this.dep = new TypeBarangRepository(db); }
public BarangFacade() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); IConfigurationRoot configuration = builder.Build(); string connectionString = configuration.GetConnectionString("DefaultConnection").ToString(); var optionsBuilder = new DbContextOptionsBuilder <ljgbContext>(); optionsBuilder.UseSqlServer(connectionString); db = new ljgbContext(optionsBuilder.Options); dep = new BarangRepository(db); da_merk = new MerkRepository(db); da_type = new TypeBarangRepository(db); da_warna = new WarnaRepository(db); da_model = new ModelBarangRepository(db); da_nego = new NegoBarangRepository(db); da_kota = new KotaRepository(db); }