/// <summary> /// 确保数据库已经创建 /// </summary> /// <param name="context">数据库上下文对象</param> public static void EnsureDatabaseCreated(AppDbContext context) { if (!_dbChecked) { _dbChecked = true; context.Database.Migrate(); } }
public AccountController(AccountService service, AppDbContext context) { _service = service; _dbContext = context; }
public AccountService(AppDbContext context, IHttpContextAccessor accessor) { _dbContext = context; _httpContext = accessor.HttpContext; }