From: <fab...@us...> - 2010-07-20 16:43:15
|
Revision: 5019 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5019&view=rev Author: fabiomaulo Date: 2010-07-20 16:43:09 +0000 (Tue, 20 Jul 2010) Log Message: ----------- Fix NH-2102 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Mapping/Property.cs trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2102/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Mapping/Property.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/Property.cs 2010-07-20 13:54:08 UTC (rev 5018) +++ trunk/nhibernate/src/NHibernate/Mapping/Property.cs 2010-07-20 16:43:09 UTC (rev 5019) @@ -294,5 +294,10 @@ // true here for the case of many-to-one and one-to-one // with lazy="no-proxy" public bool UnwrapProxy { get; set; } + + public bool IsEntityRelation + { + get { return (Value as ToOne) != null; } + } } } Modified: trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs 2010-07-20 13:54:08 UTC (rev 5018) +++ trunk/nhibernate/src/NHibernate/Tuple/Entity/EntityMetamodel.cs 2010-07-20 16:43:09 UTC (rev 5019) @@ -128,14 +128,17 @@ foreach (Mapping.Property prop in persistentClass.PropertyClosureIterator) { + // NH: A lazy property is a simple property marked with lazy=true or a relation (in this case many-to-one or one-to-one marked as "no-proxy") + bool lazyProperty = prop.IsLazy && lazyAvailable && (!prop.IsEntityRelation || prop.UnwrapProxy); + if (prop == persistentClass.Version) { tempVersionProperty = i; - properties[i] = PropertyFactory.BuildVersionProperty(prop, lazyAvailable); + properties[i] = PropertyFactory.BuildVersionProperty(prop, lazyProperty); } else { - properties[i] = PropertyFactory.BuildStandardProperty(prop, lazyAvailable); + properties[i] = PropertyFactory.BuildStandardProperty(prop, lazyProperty); } if (prop.IsNaturalIdentifier) @@ -148,7 +151,6 @@ foundNonIdentifierPropertyNamedId = true; } - bool lazyProperty = prop.IsLazy && lazyAvailable; if (lazyProperty) { hasLazy = true; Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2102/Fixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2102/Fixture.cs 2010-07-20 13:54:08 UTC (rev 5018) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2102/Fixture.cs 2010-07-20 16:43:09 UTC (rev 5019) @@ -1,17 +1,16 @@ -using NHibernate.ByteCode.Castle; using NHibernate.Cfg; using NUnit.Framework; using SharpTestsEx; namespace NHibernate.Test.NHSpecificTest.NH2102 { - [TestFixture, Ignore("Not fixed yet.")] + [TestFixture] public class Fixture : BugTestCase { protected override void Configure(Configuration configuration) { configuration.SetProperty(Environment.ProxyFactoryFactoryClass, - typeof(ProxyFactoryFactory).AssemblyQualifiedName); + typeof(ByteCode.Castle.ProxyFactoryFactory).AssemblyQualifiedName); } [Test] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |