У меня есть разные контексты базы данных с разными таблицами в одной базе данных. Таблицы имеют имя схемы после dbcontext.
В DbContextOne у меня есть модель под названием App, на которую ссылаются многие другие таблицы, но как я могу включить App в запросах к моделям в другом контексте базы данных?
DbContextOne:
Код: Выделить всё
{
public DbSet Client { get; set; }
public DbSet App { get; set; }
}
Код: Выделить всё
{
public DbSet WebSite { get; set; }
public DbSet View { get; set; }
}
Код: Выделить всё
public class WebSite : DbSecureKey, IWebSite
{
public int AppId { get; set; }
public string Title { get; set; }
public string? TitleSeparator { get; set; } = null;
public string? BaseUrl { get; set; } = null;
}
Код: Выделить всё
context.GetWorker().DbSet
.Include(st => st.App)
.ThenInclude(app => app.Client)
.Include(st => st.Options)
.Include(st => st.Cultures)
.ThenInclude(clt => clt.Culture);
Подробнее здесь: https://stackoverflow.com/questions/792 ... mework-cor