[英]Is it possible to include a list in a DbSet?
WCF 服务演示代码
public List<Message> GetMessages(string userAddress) { return this.projectContext.Messages.Include("Contacts").ToList(); }
消息类
public class Message { public int Id { get; set; } public string Text { get; set; } public List<Contact> Contacts { get; set; } }
当我尝试在客户端使用该方法时,出现下一个错误:
如果您将联系人设为实体,则可以在上下文中包含联系人实体,并通过外键将其映射到消息实体。
[英]How to mock Include method of DbSet?
[英]Filter DbSet by list of objects
[英]Is it possible to use the DbSet with a generic type?
[英]How to filter with a list of keywords on a DBSet
[英]Entity Code First DbSet using include with conditions
[英]Entity Framework DBSet Include without proxies
[英]using include on DbSet<TEntity> ef core
[英]Entity framework 6 mocking include method on dbset
[英]How to chain multiple DbSet.Include() in a loop?
[英]How to include related tables in DbSet.Find()?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.