File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/NHibernate.Test/FetchLazyProperties Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -934,6 +934,26 @@ public void TestFetchAfterEntityIsInitialized(bool readOnly)
934
934
Assert . That ( NHibernateUtil . IsPropertyInitialized ( person , "Formula" ) , Is . True ) ;
935
935
}
936
936
937
+ [ TestCase ( true ) ]
938
+ [ TestCase ( false ) ]
939
+ public void TestFetchAllPropertiesAfterEntityIsInitialized ( bool readOnly )
940
+ {
941
+ Person person ;
942
+ using ( var s = OpenSession ( ) )
943
+ using ( var tx = s . BeginTransaction ( ) )
944
+ {
945
+ person = s . CreateQuery ( "from Person where Id = 1" ) . SetReadOnly ( readOnly ) . UniqueResult < Person > ( ) ;
946
+ var image = person . Image ;
947
+ person = s . CreateQuery ( "from Person fetch all properties where Id = 1" ) . SetReadOnly ( readOnly ) . UniqueResult < Person > ( ) ;
948
+
949
+ tx . Commit ( ) ;
950
+ }
951
+
952
+ Assert . That ( NHibernateUtil . IsPropertyInitialized ( person , "Image" ) , Is . True ) ;
953
+ Assert . That ( NHibernateUtil . IsPropertyInitialized ( person , "Address" ) , Is . True ) ;
954
+ Assert . That ( NHibernateUtil . IsPropertyInitialized ( person , "Formula" ) , Is . True ) ;
955
+ }
956
+
937
957
[ Test ]
938
958
public void TestHqlCrossJoinFetchFormula ( )
939
959
{
You can’t perform that action at this time.
0 commit comments