Example #1
0
        HomesDbContext IDesignTimeDbContextFactory <HomesDbContext> .CreateDbContext(string[] args)
        {
            var optionsBuilder = new DbContextOptionsBuilder <HomesDbContext>();

            optionsBuilder.UseSqlServer(DbContextConstants.GetConnectionString());

            return(new HomesDbContext(optionsBuilder.Options));
        }
Example #2
0
 public static void AddDbContext(IServiceCollection services)
 {
     services.AddDbContext <HomesDbContext>(options => options.UseSqlServer(DbContextConstants.GetConnectionString()));
 }