Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static class DbExtensions
{
public static IQueryable<T> FilterByTenant<T>(this IQueryable<T> baseEntities, string
tenantId) where T : BaseEntity
{
return baseEntities.Where(r => r.TenantId == tenantId);
}
public static IQueryable<T> FilterByTenantName<T>(this IQueryable<T> baseEntities, string
tenantId) where T : BaseEntity
{
return baseEntities.Where(r => r.Tenant.Name == tenantId);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment