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