2

次のクエリで linq-to-nhibernate を使用しています。

ISession session = GetSession();
  var query = from storeZoneStyles in session.Linq<StoreZoneStyle>()
    from storeZones in session.Linq<StoreZone>()
      where storeZoneStyles.StoreZoneId == storeZones.StoreZoneId && storeZones.StoreCode == storeCode
    select storeZoneStyles;

このクエリでは、店舗コードに属するすべての storeZoneStyles のみを取得したいと考えています。これを実行すると、次の実行時例外が発生します。

タイプ 'System.Linq.Expressions.ConstantExpression' のオブジェクトをタイプ 'System.Linq.Expressions.LambdaExpression' にキャストできません。

誰か助けてくれませんか?

4

1 に答える 1

1

L2N では結合がサポートされていないため、代わりにこのクエリを使用する必要がありました

var query = from storeZoneStyles in session.Linq<StoreZoneStyle>()
                        where storeZoneStyles.Zone.StoreCode == storeCode
                        select storeZoneStyles;
于 2009-11-03T19:34:29.100 に答える