From: <fab...@us...> - 2008-07-22 22:05:30
|
Revision: 3649 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3649&view=rev Author: fabiomaulo Date: 2008-07-22 22:05:35 +0000 (Tue, 22 Jul 2008) Log Message: ----------- Merge r3648 (fix NH-1399) Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Mapping/Table.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/Fixture.cs Modified: trunk/nhibernate/src/NHibernate/Mapping/Table.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-07-22 21:34:20 UTC (rev 3648) +++ trunk/nhibernate/src/NHibernate/Mapping/Table.cs 2008-07-22 22:05:35 UTC (rev 3649) @@ -709,20 +709,14 @@ public string UniqueColumnString(IEnumerable iterator, string referencedEntityName) { - int result = 0; + // NH Different implementation (NH-1339) + int result = 37; if (referencedEntityName != null) - result += referencedEntityName.GetHashCode(); + result ^= referencedEntityName.GetHashCode(); foreach (object o in iterator) { - // this is marked as unchecked because the GetHashCode could potentially - // cause an integer overflow. This way if there is an overflow it will - // just roll back over - since we are not doing any computations based - // on this number then a rollover is no big deal. - unchecked - { - result += o.GetHashCode(); - } + result ^= o.GetHashCode(); } return (name.GetHashCode().ToString("X") + result.GetHashCode().ToString("X")); } Copied: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/Fixture.cs (from rev 3648, branches/2.0.x/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/Fixture.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/Fixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/Fixture.cs 2008-07-22 22:05:35 UTC (rev 3649) @@ -0,0 +1,21 @@ +using NHibernate.Mapping; +using NUnit.Framework; + +namespace NHibernate.Test.NHSpecificTest.NH1399 +{ + [TestFixture] + public class Fixture + { + [Test] + public void Bug() + { + Table table1 = new Table("ATABLE"); + + Column table1ITestManyA = new Column("itestmanyaid"); + Column table1ITestManyB = new Column("itestmanybid"); + string t1Fk = table1.UniqueColumnString(new object[] { table1ITestManyA }, "BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyA"); + string t2Fk = table1.UniqueColumnString(new object[] { table1ITestManyB }, "BluewireTechnologies.Core.Framework.DynamicTypes2.Albatross.ITestManyB"); + Assert.AreNotEqual(t1Fk, t2Fk, "Different columns in differents tables create the same FK name."); + } + } +} \ No newline at end of file Property changes on: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1399/Fixture.cs ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-07-22 21:34:20 UTC (rev 3648) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-07-22 22:05:35 UTC (rev 3649) @@ -387,6 +387,7 @@ <Compile Include="NHSpecificTest\NH1355\Category.cs" /> <Compile Include="NHSpecificTest\NH1355\CustomVersionType.cs" /> <Compile Include="NHSpecificTest\NH1355\UserTypeTimestamp.cs" /> + <Compile Include="NHSpecificTest\NH1399\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Fixture.cs" /> <Compile Include="NHSpecificTest\NH280\Foo.cs" /> <Compile Include="NHSpecificTest\NH1018\Employee.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |