1
如何在EF7
中指定我希望顯式加載我的ApplicationUser實體的引用屬性Subject?在EF6以下是命名空間System.Data.EntityFramework.Infrastructure
定義:EntityEntry <ApplicationUser>不包含'Reference'的定義
public DbReferenceEntry<TEntity, TProperty> Reference<TProperty>(Expression<Func<TEntity, TProperty>> navigationProperty) where TProperty : class;
所以這個代碼:
public async override Task<ApplicationUser> FindByIdAsync(string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var user = await base.FindByIdAsync(userId);
this.Context.Entry(user).Reference(u => u.Subjects).Load();
return user;
}
給出了一個例外
EntityEntry<ApplicationUser> does not contain a definition for 'Reference'.
凡在EF7
定義這個擴展的方法?