|
From: <fab...@us...> - 2009-05-15 22:37:23
|
Revision: 4322
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4322&view=rev
Author: fabiomaulo
Date: 2009-05-15 22:37:17 +0000 (Fri, 15 May 2009)
Log Message:
-----------
Final improvement of type name recognition on <element>
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/IntEnumsBagNoNameFixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/SimpleWithEnumsNoName.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs 2009-05-15 21:47:20 UTC (rev 4321)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs 2009-05-15 22:37:17 UTC (rev 4322)
@@ -596,8 +596,22 @@
}
else if ("element".Equals(name))
{
- SimpleValue elt = new SimpleValue(model.CollectionTable);
+ var elt = new SimpleValue(model.CollectionTable);
model.Element = elt;
+ if(model.IsGeneric)
+ {
+ switch (model.GenericArguments.Length)
+ {
+ case 1:
+ // a collection with a generic type parameter
+ elt.TypeName = model.GenericArguments[0].AssemblyQualifiedName;
+ break;
+ case 2:
+ // a map (IDictionary) with 2 parameters
+ elt.TypeName = model.GenericArguments[1].AssemblyQualifiedName;
+ break;
+ }
+ }
BindSimpleValue(subnode, elt, true, Mapping.Collection.DefaultElementColumnName);
}
else if ("many-to-many".Equals(name))
Copied: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/IntEnumsBagNoNameFixture.cs (from rev 4321, trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/IntEnumsBagPartialNameFixture.cs)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/IntEnumsBagNoNameFixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/IntEnumsBagNoNameFixture.cs 2009-05-15 22:37:17 UTC (rev 4322)
@@ -0,0 +1,14 @@
+using System.Collections;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.ElementsEnums
+{
+ [TestFixture]
+ public class IntEnumsBagNoNameFixture : AbstractIntEnumsBagFixture
+ {
+ protected override IList Mappings
+ {
+ get { return new[] { "NHSpecificTest.ElementsEnums.SimpleWithEnumsNoName.hbm.xml" }; }
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/SimpleWithEnumsNoName.hbm.xml (from rev 4321, trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/SimpleWithEnumsPartialName.hbm.xml)
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/SimpleWithEnumsNoName.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/ElementsEnums/SimpleWithEnumsNoName.hbm.xml 2009-05-15 22:37:17 UTC (rev 4322)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.ElementsEnums">
+
+ <class name="SimpleWithEnums">
+ <id type="int">
+ <generator class="native"/>
+ </id>
+
+ <property name="Something"/>
+ <bag name="Things">
+ <key column="bid"/>
+ <element column="enumvalue"/>
+ </bag>
+ </class>
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-15 21:47:20 UTC (rev 4321)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-05-15 22:37:17 UTC (rev 4322)
@@ -330,6 +330,7 @@
<Compile Include="MappingTest\NonReflectiveBinderFixture.cs" />
<Compile Include="MappingTest\Wicked.cs" />
<Compile Include="NHSpecificTest\ElementsEnums\AbstractIntEnumsBagFixture.cs" />
+ <Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagNoNameFixture.cs" />
<Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagPartialNameFixture.cs" />
<Compile Include="NHSpecificTest\ElementsEnums\IntEnumsBagFixture.cs" />
<Compile Include="NHSpecificTest\ElementsEnums\Something.cs" />
@@ -1796,6 +1797,7 @@
<EmbeddedResource Include="BulkManipulation\SimpleClass.hbm.xml" />
<EmbeddedResource Include="Ado\VerySimple.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\ElementsEnums\SimpleWithEnumsNoName.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\ElementsEnums\SimpleWithEnumsPartialName.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1343\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1264\Passenger.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|