Vici.CoolStorage:使用ManyToOne和ManyToMany关系过滤

时间:2009-09-15 13:47:19

标签: c# orm coolstorage vici

我在Vici.CoolStorage中遇到一个异常'当我在Event类的.List()方法上使用以下过滤器时,无法将'System.String'类型的对象强制转换为'QueryExpression':

Event.List("has(Resource where has(Teams where TeamID = @TeamID))", 
                "@TeamID", teamID);

- >事件 - 资源= ManyToOne关系(资源属性)

- >资源 - Team = ManyToMany关系,plural = true(CSList Teams属性)

我想使用属于指定团队的资源(teamID)检索所有事件。这可能是Vici.CoolStorage过滤器语法吗?

PS。 teamID = Guid

1 个答案:

答案 0 :(得分:1)

has()函数只能与* ToMany关系一起使用。我想你的意思是:

我想您要选择所有具有与特定团队相关的相关资源的记录?

这可能是你要找的东西:

Event.List("has(Resource.Teams where TeamID = @TeamID))", 
            "@TeamID", teamID);
相关问题