/// <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) { } }
public async Task <bool> SaveChageAsync() { return(await dbContext.SaveChangesAsync() > 0); }