加載某些行我有類實體框架 - 在導航性能
Address
PeopleAddress //join table with a column called current
People // my main table, with a IList<PeopleAddress>
modelBuilder.Entity<People>()
.HasMany<PeopleAddress>(m => m.CurrentAddresses)
.WithRequired()
.HasForeignKey(m => m.PeopleId);
我(總是)想要只載入PeopleAddress在人們那裏PeopleAddress.Current == 1 行與PeopleAddress.Current = = 0對於應用程序不是必需的。 我該如何做到這一點?這可能嗎?謝謝。
PS:我不能沒有使用Include
的上下文是在很多地方被實例化,我需要做的是在OnModelCreating(DbModelBuilder modelBuilder)