我有一个实体:
public class Tag {
public int Id { get; set; }
public string Word { get; set; }
// other properties...
// and a collection of blogposts:
public ICollection<Post> Posts { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
和模型:
public class TagModel {
public int Id { get; set; }
public string Word { get; set; }
// other properties...
// and a collection of blogposts:
public int PostsCount { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我查询这样的实体(通过EF或NH):
var tagsAnon = …Run Code Online (Sandbox Code Playgroud)