예제 #1
0
        public static RpcDbContext Create(string connectionString)
        {
            var optionsBuilder = new DbContextOptionsBuilder<RpcDbContext>();
            optionsBuilder.UseSqlServer(connectionString);

            var context = new RpcDbContext(optionsBuilder.Options);
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            return context;
        }
예제 #2
0
        public static void Init(RpcDbContext context)
        {
            //context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            if (context.TbHoliday.Any())
            {
                return;
            }

            var history = new dnc.grpcService.Model.Holiday() { HolidayName = "test", StartDate = DateTime.Parse("2018-5-1"), EndDate = DateTime.Parse("2018-5-2") };
            context.TbHoliday.Add(history);
            context.SaveChanges();
        }
예제 #3
0
 public HolidayDAL(RpcDbContext context)
 {
     _context = context;
 }