试试这个:
public static class DataExtensions
{
public static Microsoft.EntityFrameworkCore.Query.IIncludableQueryable<Account, List<Admin>> CustomIncludes(this DbSet<Account> accounts)
{
return accounts
.Include(p => p.Status)
.Include(p => p.Type)
.Include(p => p.Phones)
.Include(p => p.Users)
.Include(p => p.Admins);
}
}
那你可以说
context.Accounts.CustomIncludes();