|
From: <fab...@us...> - 2009-07-05 22:42:33
|
Revision: 4588
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4588&view=rev
Author: fabiomaulo
Date: 2009-07-05 22:42:32 +0000 (Sun, 05 Jul 2009)
Log Message:
-----------
Merge r4587 (fix NH-1867)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Util/StringHelper.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1867/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1867/AddMappingTest.cs
Modified: trunk/nhibernate/src/NHibernate/Util/StringHelper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Util/StringHelper.cs 2009-07-05 22:37:05 UTC (rev 4587)
+++ trunk/nhibernate/src/NHibernate/Util/StringHelper.cs 2009-07-05 22:42:32 UTC (rev 4588)
@@ -213,6 +213,14 @@
/// <returns></returns>
public static string Unqualify(string qualifiedName)
{
+ if(qualifiedName.IndexOf('`') > 0)
+ {
+ // less performance but correctly manage generics classes
+ // where the entity-name was not specified
+ // Note: the enitty-name is mandatory when the user want work with different type-args
+ // for the same generic-entity implementation
+ return GetClassname(qualifiedName);
+ }
return Unqualify(qualifiedName, ".");
}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1867/AddMappingTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1867/AddMappingTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1867/AddMappingTest.cs 2009-07-05 22:42:32 UTC (rev 4588)
@@ -0,0 +1,56 @@
+using NHibernate.Cfg;
+using NUnit.Framework;
+
+namespace NHibernate.Test.NHSpecificTest.NH1867
+{
+ [TestFixture]
+ public class AddMappingTest
+ {
+ private const string mappingTemplate =
+@"<?xml version='1.0' encoding='utf-8' ?>
+<hibernate-mapping xmlns='urn:nhibernate-mapping-2.2' auto-import='true'>
+ <class name='{0},NHibernate.Test'>
+ <id name='Id' column='Id' type='string'>
+ <generator class='assigned' />
+ </id>
+ </class>
+ <class name='{1},NHibernate.Test'>
+ <id name='OwnerId' column='Id' type='string'>
+ <generator class='assigned' />
+ </id>
+ </class>
+</hibernate-mapping>";
+
+ private class A
+ {
+ private string Id { get; set; }
+ public class B
+ {
+ private string OwnerId { get; set; }
+ }
+ }
+
+ private class A<T>
+ {
+ private string Id { get; set; }
+ public class B
+ {
+ private string OwnerId { get; set; }
+ }
+ }
+
+ [Test]
+ public void NestedWithinNonGeneric()
+ {
+ var configuration = new Configuration().Configure();
+ configuration.AddXml(string.Format(mappingTemplate, typeof(A).FullName, typeof(A.B).FullName));
+ }
+
+ [Test]
+ public void NestedWithinGeneric()
+ {
+ var configuration = new Configuration().Configure();
+ configuration.AddXml(string.Format(mappingTemplate, typeof(A<int>).FullName, typeof(A<int>.B).FullName));
+ }
+ }
+}
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-07-05 22:37:05 UTC (rev 4587)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-07-05 22:42:32 UTC (rev 4588)
@@ -539,6 +539,7 @@
<Compile Include="NHSpecificTest\NH1859\SampleTest.cs" />
<Compile Include="NHSpecificTest\NH1864\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1864\Model.cs" />
+ <Compile Include="NHSpecificTest\NH1867\AddMappingTest.cs" />
<Compile Include="NHSpecificTest\NH1868\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1868\Model.cs" />
<Compile Include="NHSpecificTest\NH473\Child.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|