Entity types cannot be generic

元气小坏坏 提交于 2019-12-11 18:13:20

问题


I am using the following function in the Domain Service,

public IQueryable<Dictionary<discussion_category, List<discussion_board>>> GetDiscussion_categoriesWithBoards()
{
    return new[] {
        GetDiscussion_categories().Select(c => new {
            Category = c,
            Boards = GetDiscussion_boardsByCategory(c.ID).ToList()
        }).ToDictionary(i => i.Category, i => i.Boards.ToList())
    }.AsQueryable();
}

seems to have no errors and i get the following error while compiling,

Type 'Dictionary`2' is not a valid entity type. Entity types cannot be generic.

what could be the problem?


回答1:


The type Dictionary<discussion_category, List<discussion_board>> is not a valid type to send over Ria services, unfortunately you can only send IQueryable<Entity> (As far as I can remember)

If you want to send something else, you might want to have a look at the InvokeOperation and creating Complex Types (see Complex types in this blog).



来源:https://stackoverflow.com/questions/6223473/entity-types-cannot-be-generic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!