Would you make default stores methods virtual #574
Answered
by
AndrewTriesToCode
LionelVallet
asked this question in
Q&A
-
Hello, public class EFCoreStore<TEFCoreStoreDbContext, TTenantInfo> : Finbuckle.MultiTenant.Stores.EFCoreStore<TEFCoreStoreDbContext, TTenantInfo>
where TEFCoreStoreDbContext : Finbuckle.MultiTenant.Stores.EFCoreStoreDbContext<TTenantInfo>
where TTenantInfo : class, ITenantInfo, new()
{
private readonly TEFCoreStoreDbContext _dbContext;
public EFCoreStore(TEFCoreStoreDbContext dbContext) : base(dbContext)
{
_dbContext = dbContext;
}
public override async Task<TTenantInfo> TryGetByIdentifierAsync(string identifier)
{
return await _dbContext.TenantInfo
.Where(FindTenant(identifier))
.FirstOrDefaultAsync(); // performance issue with Single, database forces the uniqueness
}
protected static Expression<Func<TTenantInfo, bool>> FindTenant(string identifier)
{
// predicate different from the default one
}
} Would you consider making the store and strategy classes virtual to let developers override methods and rely on base class ? Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
AndrewTriesToCode
Jul 29, 2022
Replies: 1 comment
-
Sure no problem. I'll put out a release this weekend. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
LionelVallet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure no problem. I'll put out a release this weekend.