/// <summary> /// 初始化路径码 /// </summary> public async Task <bool> InitPathCode() { using (var scope = _dbContextScopeFactory.Create()) { var db = scope.DbContexts.Get <JuCheapContext>(); var list = InitData.GetPathCodes(); var pathCodes = db.PathCodes.ToList(); db.PathCodes.RemoveRange(pathCodes); db.PathCodes.AddRange(list); return(await scope.SaveChangesAsync() > 0); } }