实体类型不能通用 [英] Entity types cannot be generic

查看:171
本文介绍了实体类型不能通用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在域服务中使用以下功能,

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();
}

似乎没有错误,编译时我收到以下错误, p>

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


类型'Dictionary`2'不是有效的
实体类型。实体类型不能是
通用。

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

可能是什么问题?

推荐答案

类型 Dictionary< discussion_category,List< discussion_board>> 不是通过Ria服务发送的有效类型,不幸的是,您只能发送 IQueryable< Entity> (尽可能记住)

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)

如果要发送另外,你可能想看看 InvokeOperation 和创建复杂类型(请参阅此 blog )。

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).

这篇关于实体类型不能通用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆