【问题标题】:Vici.CoolStorage: filter with ManyToOne and ManyToMany relationVici.CoolStorage:使用 ManyToOne 和 ManyToMany 关系进行过滤
【发布时间】:2010-11-28 11:25:41
【问题描述】:

在我的 Event 类的 .List() 方法上使用以下过滤器时,我在 Vici.CoolStorage 'Unable to cast object of 'System.String' to type 'QueryExpression' 中遇到异常:

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

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

-> Resource - Team = ManyToMany 关系,复数=true(CSList Teams 属性)

我想检索具有属于指定团队 (teamID) 的资源的所有事件。这在 Vici.CoolStorage 过滤器语法中是否可行?

ps。 teamID = 指导

【问题讨论】:

    标签: c# orm coolstorage vici


    【解决方案1】:

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

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

    这可能是您正在寻找的:

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

    【讨论】:

      猜你喜欢
      • 2013-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-23
      • 2020-10-17
      • 1970-01-01
      • 2017-11-15
      相关资源
      最近更新 更多