public async Task Invoke(HttpContext httpContext, GlobalDbContext dbContext)
        {
            var tenantGuid = httpContext.Request.Headers["X-Tenant-Guid"].FirstOrDefault();

            if (!string.IsNullOrEmpty(tenantGuid))
            {
                var tenant = dbContext.Tenants.FirstOrDefault(t => t.Guid.ToString() == tenantGuid);
                httpContext.Items["TENANT"] = tenant;
            }

            await _next.Invoke(httpContext);
        }
Beispiel #2
0
 public DbSeeder(GlobalDbContext context)
 {
     _context = context;
 }