Skip to content

Instantly share code, notes, and snippets.

@dcomartin dcomartin/DbContext.cs

Last active Nov 10, 2017
What would you like to do?
public class MyDbContext : DbContext
public Guid TenantId { get; }
public string Connection { get; }
public DbSet<Customer> Customers { get; set; }
public MyDbContext(Guid tenantId, string connection)
TenantId = tenantId;
Connection = connection;
this.Filter<Customer>(x => x.Where(q => q.TenantId == TenantId));
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.