File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed
NHibernate.DomainModel/Northwind Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ public class Animal
1919 public abstract class Reptile : Animal
2020 {
2121 public virtual double BodyTemperature { get ; set ; }
22+
23+ public virtual EnumStoredAsString Enum1 { get ; set ; }
2224 }
2325
2426 public class Lizard : Reptile { }
Original file line number Diff line number Diff line change 1919 <joined-subclass name =" Reptile" >
2020 <key column =" Animal" />
2121 <property name =" BodyTemperature" />
22+ <property name =" Enum1" type =" NHibernate.DomainModel.Northwind.Entities.EnumStoredAsStringType, NHibernate.DomainModel"
23+ formula =" ('Unspecified')" insert =" false" update =" false" >
24+ </property >
2225
2326 <joined-subclass name =" Lizard" >
2427 <key column =" Reptile" />
3942 </joined-subclass >
4043 </joined-subclass >
4144 </class >
42- </hibernate-mapping >
45+ </hibernate-mapping >
Original file line number Diff line number Diff line change @@ -84,6 +84,19 @@ public void EqualStringEnumTest()
8484 ) ;
8585 }
8686
87+ [ Test ]
88+ public void SubClassStringEnumTest ( )
89+ {
90+ AssertResults (
91+ new Dictionary < string , Predicate < IType > >
92+ {
93+ { "0" , o => o is EnumStoredAsStringType }
94+ } ,
95+ db . Animals . Where ( o => o . Children . OfType < Reptile > ( ) . Any ( r => r . Enum1 == EnumStoredAsString . Unspecified ) ) ,
96+ db . Animals . Where ( o => o . Children . OfType < Reptile > ( ) . Any ( r => EnumStoredAsString . Unspecified == r . Enum1 ) )
97+ ) ;
98+ }
99+
87100 [ Test ]
88101 public void EqualsMethodStringTest ( )
89102 {
Original file line number Diff line number Diff line change 1616using NHibernate . Type ;
1717using Remotion . Linq . Clauses ;
1818using Remotion . Linq . Clauses . Expressions ;
19+ using Remotion . Linq . Clauses . ResultOperators ;
1920using Remotion . Linq . Parsing ;
2021
2122namespace NHibernate . Util
@@ -716,6 +717,12 @@ protected override Expression VisitQuerySourceReference(QuerySourceReferenceExpr
716717
717718 protected override Expression VisitSubQuery ( SubQueryExpression expression )
718719 {
720+ var ofTypeOperator = expression . QueryModel . ResultOperators . OfType < OfTypeResultOperator > ( ) . FirstOrDefault ( ) ;
721+ if ( ofTypeOperator != null )
722+ {
723+ _convertType = ofTypeOperator . SearchedItemType ;
724+ }
725+
719726 base . Visit ( expression . QueryModel . SelectClause . Selector ) ;
720727 return expression ;
721728 }
You can’t perform that action at this time.
0 commit comments