예제 #1
0
 /// <summary>
 /// 初始化添加数据
 /// </summary>
 /// <param name="dbContext"></param>
 public static void DataInit(LLDbContext dbContext)
 {
     try
     {
         if (dbContext.Users.Any())
         {
             return;
         }
         //添加用户
         dbContext.Users.AddRange(new Users {
             UserName = "******", PassWord = Md5Encry.Encry("123456"), Delstate = 0
         }, new Users {
             UserName = "******", PassWord = Md5Encry.Encry("123456"), Delstate = 0
         });
         dbContext.SaveChangesAsync();
     }
     catch (Exception ex)
     {
     }
 }
예제 #2
0
 public async Task <bool> SaveChageAsync()
 {
     return(await dbContext.SaveChangesAsync() > 0);
 }