❔ Cannot change table from second call
hello, according to this document https://learn.microsoft.com/en-us/ef/core/modeling/dynamic-model, i want to get dynamic model so i create a class that inherited from
If i want to change table, i just call
and when i call
Basically, it works perfectly.
But now the problem is, when i do this
The
How can i change table from second line
IModelCacheKeyFactory If i want to change table, i just call
and when i call
_context.Set<TB1>() or _context.Database.GetDbConnection(), the CustomModelCacheKey will run and the table will be changed from TB1 to TB1_Other.Basically, it works perfectly.
But now the problem is, when i do this
The
CustomModelCacheKey will be fired only once on line var tb1 = _context.Set<TB1>(); , and not on line var tb2 = _context.Set<TB2>(); . So, from model TB1 and TB2, i will get data from table TB1_OTher and TB2How can i change table from second line
var tb2 = _context.Set<TB2>(); like above