From: Michael D. <mik...@us...> - 2005-01-17 03:41:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11286/NHibernate.Test Modified Files: ABCProxyTest.cs FooBarTest.cs FumTest.cs MasterDetailTest.cs ParentChildTest.cs SimpleTest.cs Log Message: Renamed NHibernate.NHibernate to NHibernate.NHibernateUtil. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** FooBarTest.cs 13 Jan 2005 20:54:02 -0000 1.80 --- FooBarTest.cs 17 Jan 2005 03:40:51 -0000 1.81 *************** *** 57,61 **** fooBag = baz.FooBag; s.Find("from Baz baz left join fetch baz.FooBag"); ! Assert.IsTrue( NHibernate.IsInitialized(fooBag) ); Assert.IsTrue( fooBag==baz.FooBag ); Assert.IsTrue( baz.FooBag.Count==2 ); --- 57,61 ---- fooBag = baz.FooBag; s.Find("from Baz baz left join fetch baz.FooBag"); ! Assert.IsTrue( NHibernateUtil.IsInitialized(fooBag) ); Assert.IsTrue( fooBag==baz.FooBag ); Assert.IsTrue( baz.FooBag.Count==2 ); *************** *** 65,71 **** baz = (Baz) s.Load( typeof(Baz), baz.Code ); Object bag = baz.FooBag; ! Assert.IsFalse( NHibernate.IsInitialized(bag) ); s.Find("from Baz baz left join fetch fooBag"); ! Assert.IsFalse( NHibernate.IsInitialized(bag) ); Assert.IsTrue( bag==baz.FooBag ); Assert.IsTrue( baz.FooBag.Count==2 ); --- 65,71 ---- baz = (Baz) s.Load( typeof(Baz), baz.Code ); Object bag = baz.FooBag; ! Assert.IsFalse( NHibernateUtil.IsInitialized(bag) ); s.Find("from Baz baz left join fetch fooBag"); ! Assert.IsFalse( NHibernateUtil.IsInitialized(bag) ); Assert.IsTrue( bag==baz.FooBag ); Assert.IsTrue( baz.FooBag.Count==2 ); *************** *** 167,171 **** baz.Fees = list; list = s.Find("from Foo foo, Baz baz left join fetch baz.Fees"); ! Assert.IsTrue( NHibernate.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).Fees ) ); s.Delete(foo); s.Delete(foo2); --- 167,171 ---- baz.Fees = list; list = s.Find("from Foo foo, Baz baz left join fetch baz.Fees"); ! Assert.IsTrue( NHibernateUtil.IsInitialized( ( (Baz) ( (object[]) list[0] )[1] ).Fees ) ); s.Delete(foo); s.Delete(foo2); *************** *** 275,282 **** s = sessions.OpenSession(); baz = (Baz)s.Load( typeof(Baz), id ); ! Assert.IsFalse( NHibernate.IsInitialized( baz.FooBag ) ); Assert.AreEqual( 1, baz.FooBag.Count ); ! Assert.IsTrue( NHibernate.IsInitialized( baz.FooBag[0] ) ); s.Delete(baz); s.Flush(); --- 275,282 ---- s = sessions.OpenSession(); baz = (Baz)s.Load( typeof(Baz), id ); ! Assert.IsFalse( NHibernateUtil.IsInitialized( baz.FooBag ) ); Assert.AreEqual( 1, baz.FooBag.Count ); ! Assert.IsTrue( NHibernateUtil.IsInitialized( baz.FooBag[0] ) ); s.Delete(baz); s.Flush(); *************** *** 372,378 **** s = sessions.OpenSession(); f = (FooProxy)s.Load( typeof(Foo), id ); ! Assert.IsFalse( NHibernate.IsInitialized( f ) ); ! Assert.IsTrue( NHibernate.IsInitialized( f.Component.Glarch ) ); //outer-join="true" ! Assert.IsFalse( NHibernate.IsInitialized( f.TheFoo ) ); //outer-join="auto" Assert.AreEqual( gid, s.GetIdentifier( f.Component.Glarch ) ); s.Delete( f ); --- 372,378 ---- s = sessions.OpenSession(); f = (FooProxy)s.Load( typeof(Foo), id ); ! Assert.IsFalse( NHibernateUtil.IsInitialized( f ) ); ! Assert.IsTrue( NHibernateUtil.IsInitialized( f.Component.Glarch ) ); //outer-join="true" ! Assert.IsFalse( NHibernateUtil.IsInitialized( f.TheFoo ) ); //outer-join="auto" Assert.AreEqual( gid, s.GetIdentifier( f.Component.Glarch ) ); s.Delete( f ); *************** *** 696,700 **** f = (Foo) list[0]; ! Assert.IsTrue(NHibernate.IsInitialized(f.TheFoo)); //TODO: this is initialized because Proxies are not implemented yet. --- 696,700 ---- f = (Foo) list[0]; ! Assert.IsTrue(NHibernateUtil.IsInitialized(f.TheFoo)); //TODO: this is initialized because Proxies are not implemented yet. *************** *** 847,854 **** Type.IType[] types = new Type.IType[] { ! NHibernate.Entity(typeof(Foo)), ! NHibernate.Int64, ! NHibernate.Int32, ! NHibernate.String }; --- 847,854 ---- Type.IType[] types = new Type.IType[] { ! NHibernateUtil.Entity(typeof(Foo)), ! NHibernateUtil.Int64, ! NHibernateUtil.Int32, ! NHibernateUtil.String }; *************** *** 861,867 **** types = new Type.IType[] { ! NHibernate.Entity(typeof(Foo)), ! NHibernate.Int64, ! NHibernate.String }; --- 861,867 ---- types = new Type.IType[] { ! NHibernateUtil.Entity(typeof(Foo)), ! NHibernateUtil.Int64, ! NHibernateUtil.String }; *************** *** 1543,1549 **** b = (BarProxy)s.Load( typeof(Foo), b.Key ); string tempKey = b.Key; ! Assert.IsFalse( NHibernate.IsInitialized(b), "b should have been an unitialized Proxy" ); string tempString = b.BarString; ! Assert.IsTrue( NHibernate.IsInitialized(b), "b should have been an initialized Proxy" ); BarProxy b2 = (BarProxy)s.Load( typeof(Bar), tempKey ); Qux q2 = (Qux)s.Load( typeof(Qux), q.Key ); --- 1543,1549 ---- b = (BarProxy)s.Load( typeof(Foo), b.Key ); string tempKey = b.Key; ! Assert.IsFalse( NHibernateUtil.IsInitialized(b), "b should have been an unitialized Proxy" ); string tempString = b.BarString; ! Assert.IsTrue( NHibernateUtil.IsInitialized(b), "b should have been an initialized Proxy" ); BarProxy b2 = (BarProxy)s.Load( typeof(Bar), tempKey ); Qux q2 = (Qux)s.Load( typeof(Qux), q.Key ); *************** *** 1741,1745 **** s.Delete( "from t in class NHibernate.DomainModel.Trivial" ); ! list2 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.Date = ?", new DateTime(2123,2,3), NHibernate.Date ); Assert.AreEqual( 4, list2.Count, "find by date" ); IEnumerator enumer = list2.GetEnumerator(); --- 1741,1745 ---- s.Delete( "from t in class NHibernate.DomainModel.Trivial" ); ! list2 = s.Find( "from foo in class NHibernate.DomainModel.Foo where foo.Date = ?", new DateTime(1970, 01, 01), NHibernateUtil.Date ); Assert.AreEqual( 4, list2.Count, "find by date" ); IEnumerator enumer = list2.GetEnumerator(); *************** *** 1768,1772 **** IList list = s.Find( "from Foo foo inner join fetch foo.TheFoo" ); Foo foof = (Foo)list[0]; ! Assert.IsTrue( NHibernate.IsInitialized( foof.TheFoo ) ); list = s.Find( "from Baz baz left outer join fetch baz.FooToGlarch" ); --- 1768,1772 ---- IList list = s.Find( "from Foo foo inner join fetch foo.TheFoo" ); Foo foof = (Foo)list[0]; ! Assert.IsTrue( NHibernateUtil.IsInitialized( foof.TheFoo ) ); list = s.Find( "from Baz baz left outer join fetch baz.FooToGlarch" ); *************** *** 1774,1778 **** list = s.Find( "select foo, bar from Foo foo left outer join foo.TheFoo bar where foo = ?", foo, ! NHibernate.Entity( typeof(Foo) ) ); --- 1774,1778 ---- list = s.Find( "select foo, bar from Foo foo left outer join foo.TheFoo bar where foo = ?", foo, ! NHibernateUtil.Entity( typeof(Foo) ) ); *************** *** 1838,1842 **** { // add an !InterbaseDialect wrapper around list and assert ! list = s.Find( "from foo in class NHibernate.DomainModel.Foo where ? = some foo.Component.ImportantDates.elements", new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ), NHibernate.DateTime ); Assert.AreEqual( 2, list.Count, "componenet query" ); } --- 1838,1842 ---- { // add an !InterbaseDialect wrapper around list and assert ! list = s.Find( "from foo in class NHibernate.DomainModel.Foo where ? = some foo.Component.ImportantDates.elements", new DateTime( DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ), NHibernateUtil.DateTime ); Assert.AreEqual( 2, list.Count, "componenet query" ); } *************** *** 2062,2066 **** Assert.AreEqual(8, ! s.Delete("from q in class NHibernate.DomainModel.Qux where q.Stuff=?", "foo", NHibernate.String), "delete by query"); --- 2062,2066 ---- Assert.AreEqual(8, ! s.Delete("from q in class NHibernate.DomainModel.Qux where q.Stuff=?", "foo", NHibernateUtil.String), "delete by query"); *************** *** 2077,2080 **** --- 2077,2140 ---- } + /// <summary> + /// Adding a test to verify that a database action can occur in the + /// middle of an Enumeration. Under certain conditions an open + /// DataReader can be kept open and cause anyother action to fail. + /// </summary> + [Test] + public void EnumerableDisposable() + { + // this test used to be called Iterators() + + ISession s = sessions.OpenSession(); + for( int i=0; i<10; i++ ) + { + Simple simple = new Simple(); + simple.Count = i; + s.Save(simple, i); + Assert.IsNotNull(simple, "simple is not null"); + } + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + ITransaction t = s.BeginTransaction(); + Simple simp = (Simple)s.Load( typeof(Simple), 8 ); + + // the reader under the enum has to still be a SqlDataReader (subst db name here) and + // can't be a NDataReader - the best way to get this result is to query on just a property + // of an object. If the query is "from Simple as s" then it will be converted to a NDataReader + // on the MoveNext so it can get the object from the id - thus needing another open DataReader so + // it must convert to an NDataReader. + IEnumerable enumer = s.Enumerable("select s.Count from Simple as s"); + //int count = 0; + foreach( object obj in enumer ) + { + if( (int)obj==7 ) + { + break; + } + } + + // if Enumerable doesn't implement Dispose() then the test fails on this line + t.Commit(); + s.Close(); + + s = sessions.OpenSession(); + Assert.AreEqual( 10, + s.Delete( "from Simple" ), + "delete by query" ); + + s.Flush(); + s.Close(); + + s = sessions.OpenSession(); + enumer = s.Enumerable("from Simple"); + Assert.IsFalse( enumer.GetEnumerator().MoveNext() , "no items in enumerator" ); + s.Flush(); + s.Close(); + + } + [Test] public void Versioning() *************** *** 2096,2101 **** GlarchProxy gOld = (GlarchProxy)sOld.Load( typeof(Glarch), gid ); // want gOld to be initialized so later I can change a property ! NHibernate.Initialize( gOld ); ! Assert.IsTrue( NHibernate.IsInitialized( gOld ), "should be initialized" ); sOld.Close(); --- 2156,2161 ---- GlarchProxy gOld = (GlarchProxy)sOld.Load( typeof(Glarch), gid ); // want gOld to be initialized so later I can change a property ! NHibernateUtil.Initialize( gOld ); ! Assert.IsTrue( NHibernateUtil.IsInitialized( gOld ), "should be initialized" ); sOld.Close(); *************** *** 3002,3006 **** s.Load( im, im.Id); ! Immutable imFromFind = (Immutable)s.Find("from im in class Immutable where im = ?", im, NHibernate.Entity(typeof(Immutable)))[0]; Immutable imFromLoad = (Immutable)s.Load(typeof(Immutable), im.Id); --- 3062,3066 ---- s.Load( im, im.Id); ! Immutable imFromFind = (Immutable)s.Find("from im in class Immutable where im = ?", im, NHibernateUtil.Entity(typeof(Immutable)))[0]; Immutable imFromLoad = (Immutable)s.Load(typeof(Immutable), im.Id); *************** *** 3188,3192 **** e = s.Enumerable("from baz in class NHibernate.DomainModel.Baz where ? in baz.FooArray.elements", foo, ! NHibernate.Entity( typeof(Foo) ) ).GetEnumerator(); Assert.IsFalse( e.MoveNext() ); --- 3248,3252 ---- e = s.Enumerable("from baz in class NHibernate.DomainModel.Baz where ? in baz.FooArray.elements", foo, ! NHibernateUtil.Entity( typeof(Foo) ) ).GetEnumerator(); Assert.IsFalse( e.MoveNext() ); *************** *** 3341,3345 **** "from Bar bar where bar.Object.id = ? and bar.Object.class = ?", new object[] { oid, typeof(One) }, ! new Type.IType[] { NHibernate.Int64, NHibernate.Class } ); Assert.AreEqual(1, list.Count); --- 3401,3405 ---- "from Bar bar where bar.Object.id = ? and bar.Object.class = ?", new object[] { oid, typeof(One) }, ! new Type.IType[] { NHibernateUtil.Int64, NHibernateUtil.Class } ); Assert.AreEqual(1, list.Count); *************** *** 3612,3616 **** s = sessions.OpenSession(); ! foo = (Foo)s.Find( "from Foo as f where f.id = ?", id, NHibernate.String)[0]; Assert.AreEqual( 4, foo.Formula, "should be 2x 'Int' property that is defaulted to 2" ); --- 3672,3676 ---- s = sessions.OpenSession(); ! foo = (Foo)s.Find( "from Foo as f where f.id = ?", id, NHibernateUtil.String)[0]; Assert.AreEqual( 4, foo.Formula, "should be 2x 'Int' property that is defaulted to 2" ); Index: SimpleTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SimpleTest.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SimpleTest.cs 1 Jan 2005 20:39:38 -0000 1.7 --- SimpleTest.cs 17 Jan 2005 03:40:51 -0000 1.8 *************** *** 101,105 **** // Simple simple3 = (Simple)s3.Load(typeof(Simple), key); ! Simple simple3 = (Simple)s3.Find( "from Simple as s where s.id = ? and '?'='?'", key, NHibernate.Int64 )[0]; Simple otherSimple3; --- 101,105 ---- // Simple simple3 = (Simple)s3.Load(typeof(Simple), key); ! Simple simple3 = (Simple)s3.Find( "from Simple as s where s.id = ? and '?'='?'", key, NHibernateUtil.Int64 )[0]; Simple otherSimple3; Index: FumTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FumTest.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** FumTest.cs 1 Jan 2005 20:39:38 -0000 1.17 --- FumTest.cs 17 Jan 2005 03:40:51 -0000 1.18 *************** *** 242,246 **** // Try to fnd the Fum object "fi" that we inserted by searching the date in the id ! vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.Short = ?", fiShort, NHibernate.Int16 ); Assert.AreEqual( 1, vList.Count, "find by composite key query (find fi object)" ); fi = (Fum)vList[0]; --- 242,246 ---- // Try to fnd the Fum object "fi" that we inserted by searching the date in the id ! vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.Short = ?", fiShort, NHibernateUtil.Int16 ); Assert.AreEqual( 1, vList.Count, "find by composite key query (find fi object)" ); fi = (Fum)vList[0]; *************** *** 248,252 **** // make sure we can return all of the objects by searching by the date id ! vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.Date <= ? and not fum.FumString='FRIEND'", DateTime.Now, NHibernate.Date); Assert.AreEqual( 4, vList.Count, "find by composite key query with arguments" ); s.Flush(); --- 248,252 ---- // make sure we can return all of the objects by searching by the date id ! vList = s.Find("from fum in class NHibernate.DomainModel.Fum where fum.Id.Date <= ? and not fum.FumString='FRIEND'", DateTime.Now, NHibernateUtil.Date); Assert.AreEqual( 4, vList.Count, "find by composite key query with arguments" ); s.Flush(); *************** *** 279,283 **** fum = (Fum)s.Load( typeof(Fum), fum.Id ); s.Filter( fum.QuxArray, "where this.Foo is null" ); ! s.Filter( fum.QuxArray, "where this.Foo.id = ?", "fooid", NHibernate.String ); IQuery f = s.CreateFilter( fum.QuxArray, "where this.Foo.id = :fooId" ); f.SetString("fooId", "abc"); --- 279,283 ---- fum = (Fum)s.Load( typeof(Fum), fum.Id ); s.Filter( fum.QuxArray, "where this.Foo is null" ); ! s.Filter( fum.QuxArray, "where this.Foo.id = ?", "fooid", NHibernateUtil.String ); IQuery f = s.CreateFilter( fum.QuxArray, "where this.Foo.id = :fooId" ); f.SetString("fooId", "abc"); *************** *** 463,467 **** s = sessions.OpenSession(); ! d = (Outer)s.Find("from Outer o where o.id.DetailId=?", d.Id.DetailId, NHibernate.String)[0]; s.Find("from Outer o where o.Id.Master.Id.Sup.Dudu is not null"); s.Find("from Outer o where o.Id.Master.Bla = ''"); --- 463,467 ---- s = sessions.OpenSession(); ! d = (Outer)s.Find("from Outer o where o.id.DetailId=?", d.Id.DetailId, NHibernateUtil.String)[0]; s.Find("from Outer o where o.Id.Master.Id.Sup.Dudu is not null"); s.Find("from Outer o where o.Id.Master.Bla = ''"); Index: ParentChildTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ParentChildTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ParentChildTest.cs 1 Jan 2005 20:39:38 -0000 1.11 --- ParentChildTest.cs 17 Jan 2005 03:40:51 -0000 1.12 *************** *** 153,157 **** s.Find("select c, c.Parent from c in class NHibernate.DomainModel.Child where c.Parent.Count=66 order by c.Parent.Count"); s.Enumerable("select c, c.Parent, c.Parent.Count from c in class NHibernate.DomainModel.Child order by c.Parent.Count"); ! Assert.AreEqual( 1, s.Find("FROM p in CLASS NHibernate.DomainModel.Parent WHERE p.Count=?", (int)66, NHibernate.Int32).Count, "1-1 query" ); s.Delete(c); s.Delete(p); --- 153,157 ---- s.Find("select c, c.Parent from c in class NHibernate.DomainModel.Child where c.Parent.Count=66 order by c.Parent.Count"); s.Enumerable("select c, c.Parent, c.Parent.Count from c in class NHibernate.DomainModel.Child order by c.Parent.Count"); ! Assert.AreEqual( 1, s.Find("FROM p in CLASS NHibernate.DomainModel.Parent WHERE p.Count=?", (int)66, NHibernateUtil.Int32).Count, "1-1 query" ); s.Delete(c); s.Delete(p); Index: ABCProxyTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/ABCProxyTest.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ABCProxyTest.cs 1 Jan 2005 20:39:37 -0000 1.11 --- ABCProxyTest.cs 17 Jan 2005 03:40:51 -0000 1.12 *************** *** 65,69 **** // Test won't run after this line because of proxy initalization problems A c1a = (A) s.Load(typeof(A), c1.Id ); ! Assert.IsFalse( NHibernate.IsInitialized(c1a) ); Assert.IsTrue( c1a.Name.Equals("c1") ); t.Commit(); --- 65,69 ---- // Test won't run after this line because of proxy initalization problems A c1a = (A) s.Load(typeof(A), c1.Id ); ! Assert.IsFalse( NHibernateUtil.IsInitialized(c1a) ); Assert.IsTrue( c1a.Name.Equals("c1") ); t.Commit(); Index: MasterDetailTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MasterDetailTest.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MasterDetailTest.cs 24 Nov 2004 14:34:45 -0000 1.17 --- MasterDetailTest.cs 17 Jan 2005 03:40:51 -0000 1.18 *************** *** 171,175 **** IList list = s.Find("from Master m left join fetch m.Details"); Master m = (Master)list[0]; ! Assert.IsTrue( NHibernate.IsInitialized( m.Details ), "joined fetch should initialize collection" ); Assert.AreEqual( 2, m.Details.Count ); list = s.Find("from Detail d inner join fetch d.Master"); --- 171,175 ---- IList list = s.Find("from Master m left join fetch m.Details"); Master m = (Master)list[0]; ! Assert.IsTrue( NHibernateUtil.IsInitialized( m.Details ), "joined fetch should initialize collection" ); Assert.AreEqual( 2, m.Details.Count ); list = s.Find("from Detail d inner join fetch d.Master"); *************** *** 183,187 **** t = s.BeginTransaction(); list = s.Find("select m from Master m1, Master m left join fetch m.Details where m.Name=m1.Name"); ! Assert.IsTrue( NHibernate.IsInitialized( ((Master)list[0]).Details ) ); dt = (Detail)s.Load( typeof(Detail), dtid ); Assert.IsTrue( ((Master)list[0]).Details.Contains(dt) ); --- 183,187 ---- t = s.BeginTransaction(); list = s.Find("select m from Master m1, Master m left join fetch m.Details where m.Name=m1.Name"); ! Assert.IsTrue( NHibernateUtil.IsInitialized( ((Master)list[0]).Details ) ); dt = (Detail)s.Load( typeof(Detail), dtid ); Assert.IsTrue( ((Master)list[0]).Details.Contains(dt) ); *************** *** 193,197 **** list = s.Find("select m, m1.Name from Master m1, Master m left join fetch m.Details where m.Name=m1.Name"); Master masterFromHql = (Master)((object[])list[0])[0]; ! Assert.IsTrue( NHibernate.IsInitialized( masterFromHql.Details ) ); dt = (Detail)s.Load( typeof(Detail), dtid ); Assert.IsTrue( masterFromHql.Details.Contains(dt) ); --- 193,197 ---- list = s.Find("select m, m1.Name from Master m1, Master m left join fetch m.Details where m.Name=m1.Name"); Master masterFromHql = (Master)((object[])list[0])[0]; ! Assert.IsTrue( NHibernateUtil.IsInitialized( masterFromHql.Details ) ); dt = (Detail)s.Load( typeof(Detail), dtid ); Assert.IsTrue( masterFromHql.Details.Contains(dt) ); *************** *** 633,637 **** s.Close(); ! Assert.IsFalse( NHibernate.IsInitialized( c.Subcategories ) ); s = sessions.OpenSession(); --- 633,637 ---- s.Close(); ! Assert.IsFalse( NHibernateUtil.IsInitialized( c.Subcategories ) ); s = sessions.OpenSession(); |