OK, Google, I am not able to googling it. Documentation says
The model for that context is then cached and is for all further instances of the context in the app domain. This caching can be disabled by setting the ModelCaching property on the given ModelBuidler
and SO confirms it. But i can't find way to do it. I have to disable caching because i want to get data from several log table with same structure via just one model, so my code looks like
logTableNames.ForEach(n =>
{
using (var context = new LogContext(n))
{
Console.WriteLine($"Project: {n} -- {context.Logs.Count()} rows.
");
}
});
and configure with
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Log>().ToTable(_tableName);
}
but 'OnModelCreating' method called just once and i can not reconfigure table mapping. So maybe there is another true-way to do my task?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…