|
From: <fab...@us...> - 2011-04-03 13:29:07
|
Revision: 5588
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5588&view=rev
Author: fabiomaulo
Date: 2011-04-03 13:29:00 +0000 (Sun, 03 Apr 2011)
Log Message:
-----------
Fixed IsEntity
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs
trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs
Modified: trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate/Mapping/ByCode/ExplicitlyDeclaredModel.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -400,13 +400,7 @@
public bool IsEntity(System.Type type)
{
- return rootEntities.Contains(type) ||
- tablePerClassEntities.Contains(type) ||
- tablePerClassHierarchyEntities.Contains(type) ||
- tablePerClassHierarchyJoinEntities.Contains(type) ||
- tablePerConcreteClassEntities.Contains(type) ||
- HasDelayedEntityRegistration(type)
- ;
+ return rootEntities.Contains(type) || type.GetBaseTypes().Any(t => rootEntities.Contains(t)) || HasDelayedEntityRegistration(type);
}
public bool IsTablePerClass(System.Type type)
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/JoinedSubclassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -74,5 +74,15 @@
inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsJoinedSubclassThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerClassEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/RootClassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -154,5 +154,14 @@
inspector.AddAsRootEntity(typeof(MyClass));
inspector.Executing(x => x.AddAsTablePerClassEntity(typeof(MyClass))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsRootThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+
+ inspector.IsEntity(typeof(MyClass)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassJoinMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -74,5 +74,15 @@
inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsSubclassJoinThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerClassHierarchyJoinEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/SubclassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -75,5 +75,14 @@
inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+ [Test]
+ public void WhenRegisteredAsSubclassThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs 2011-04-03 11:20:11 UTC (rev 5587)
+++ trunk/nhibernate/src/NHibernate.Test/MappingByCode/ExplicitlyDeclaredModelTests/UnionSubclassMappingStrategyTests.cs 2011-04-03 13:29:00 UTC (rev 5588)
@@ -74,5 +74,15 @@
inspector.Executing(x => x.AddAsTablePerClassEntity(typeof(Inherited1))).Throws<MappingException>();
}
+
+ [Test]
+ public void WhenRegisteredAsUnionSubclassThenIsEntity()
+ {
+ var inspector = new ExplicitlyDeclaredModel();
+ inspector.AddAsRootEntity(typeof(MyClass));
+ inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1));
+
+ inspector.IsEntity(typeof(Inherited1)).Should().Be.True();
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|