Exemple #1
0
 public static void Initialize(PromotionContext context)
 {
     //如果没有数据库,那么新建数据库
     //context.Database.EnsureCreated();
     //context.Database.Migrate();
     if (context.Promotions.Any())
     {
         return;
     }
     context.Promotions.AddRange(Initialize());
     if (context.SaveChanges() == 0)
     {
         throw new Exception("写入默认数据失败。");
     }
 }
 public PromotionContextTransactionBehavior(PromotionContext dbContext
                                            , ILogger <PromotionContextTransactionBehavior <TRequest, TResponse> > logger)
     : base(dbContext, logger)
 {
 }