You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
| 2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
| 2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
| 2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
| 2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
| 2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
| 2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
| 2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
| 2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <fab...@us...> - 2010-07-23 16:24:00
|
Revision: 5056
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5056&view=rev
Author: fabiomaulo
Date: 2010-07-23 16:23:54 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Fixed Nant build for release
Modified Paths:
--------------
trunk/nhibernate/default.build
Modified: trunk/nhibernate/default.build
===================================================================
--- trunk/nhibernate/default.build 2010-07-23 14:37:02 UTC (rev 5055)
+++ trunk/nhibernate/default.build 2010-07-23 16:23:54 UTC (rev 5056)
@@ -300,7 +300,8 @@
<include name="Antlr3.Runtime.dll" />
<include name="Iesi.Collections.???" />
<include name="log4net*" />
- <include name="NHibernate.???" />
+ <include name="Remotion.Data.Linq.dll" />
+ <include name="NHibernate.???" />
</fileset>
</copy>
<!--Required Bins for lazy loading NHibernate.ByteCode.Castle.dll-->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-23 14:37:09
|
Revision: 5055
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5055&view=rev
Author: fabiomaulo
Date: 2010-07-23 14:37:02 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Fix NH-2194
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Util/PropertiesHelper.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/UtilityTest/PropertiesHelperTest.cs
Modified: trunk/nhibernate/src/NHibernate/Util/PropertiesHelper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Util/PropertiesHelper.cs 2010-07-23 05:37:14 UTC (rev 5054)
+++ trunk/nhibernate/src/NHibernate/Util/PropertiesHelper.cs 2010-07-23 14:37:02 UTC (rev 5055)
@@ -12,29 +12,29 @@
{
string toParse;
properties.TryGetValue(property, out toParse);
-
- return toParse == null ? defaultValue : bool.Parse(toParse);
+ bool result;
+ return bool.TryParse(toParse, out result) ? result : defaultValue;
}
public static bool GetBoolean(string property, IDictionary<string, string> properties)
{
- string toParse;
- properties.TryGetValue(property, out toParse);
- return toParse == null ? false : bool.Parse(properties[property]);
+ return GetBoolean(property, properties, false);
}
public static int GetInt32(string property, IDictionary<string, string> properties, int defaultValue)
{
string toParse;
properties.TryGetValue(property, out toParse);
- return toParse == null ? defaultValue : int.Parse(toParse);
+ int result;
+ return int.TryParse(toParse, out result) ? result : defaultValue;
}
public static long GetInt64(string property, IDictionary<string, string> properties, long defaultValue)
{
string toParse;
properties.TryGetValue(property, out toParse);
- return toParse == null ? defaultValue : long.Parse(toParse);
+ long result;
+ return long.TryParse(toParse, out result) ? result : defaultValue;
}
public static string GetString(string property, IDictionary<string, string> properties, string defaultValue)
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 05:37:14 UTC (rev 5054)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 14:37:02 UTC (rev 5055)
@@ -1610,6 +1610,7 @@
<Compile Include="UtilityTest\JoinedEnumerableGenericFixture.cs" />
<Compile Include="UtilityTest\LinkedHashMapFixture.cs" />
<Compile Include="UtilityTest\LRUMapFixture.cs" />
+ <Compile Include="UtilityTest\PropertiesHelperTest.cs" />
<Compile Include="UtilityTest\ReflectHelperFixture.cs" />
<Compile Include="UtilityTest\SafetyEnumerableFixture.cs" />
<Compile Include="UtilityTest\SequencedHashMapFixture.cs" />
Added: trunk/nhibernate/src/NHibernate.Test/UtilityTest/PropertiesHelperTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/UtilityTest/PropertiesHelperTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/UtilityTest/PropertiesHelperTest.cs 2010-07-23 14:37:02 UTC (rev 5055)
@@ -0,0 +1,46 @@
+using System.Collections.Generic;
+using NHibernate.Util;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.UtilityTest
+{
+ public class PropertiesHelperTest
+ {
+ [Test]
+ public void WhenInvalidBoolValueThenUseDefault()
+ {
+ PropertiesHelper.GetBoolean("myProp", new Dictionary<string, string> {{"myProp", "pizza"}}, false).Should().Be.False();
+ }
+
+ [Test]
+ public void WhenInvalidInt32ValueThenUseDefault()
+ {
+ PropertiesHelper.GetInt32("myProp", new Dictionary<string, string> { { "myProp", "pizza" } }, 5).Should().Be(5);
+ }
+
+ [Test]
+ public void WhenInvalidInt64ValueThenUseDefault()
+ {
+ PropertiesHelper.GetInt64("myProp", new Dictionary<string, string> { { "myProp", "pizza" } }, 5).Should().Be(5);
+ }
+
+ [Test]
+ public void WhenValidBoolValueThenValue()
+ {
+ PropertiesHelper.GetBoolean("myProp", new Dictionary<string, string> { { "myProp", "true" } }, false).Should().Be.True();
+ }
+
+ [Test]
+ public void WhenValidInt32ValueThenValue()
+ {
+ PropertiesHelper.GetInt32("myProp", new Dictionary<string, string> { { "myProp", int.MaxValue.ToString() } }, 5).Should().Be(int.MaxValue);
+ }
+
+ [Test]
+ public void WhenValidInt64ValueThenValue()
+ {
+ PropertiesHelper.GetInt64("myProp", new Dictionary<string, string> { { "myProp", long.MaxValue.ToString() } }, 5).Should().Be(long.MaxValue);
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-23 05:37:20
|
Revision: 5054
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5054&view=rev
Author: fabiomaulo
Date: 2010-07-23 05:37:14 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Changed the cause-description of the issue
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs 2010-07-23 05:27:34 UTC (rev 5053)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs 2010-07-23 05:37:14 UTC (rev 5054)
@@ -6,7 +6,7 @@
{
public class Fixture : BugTestCase
{
- [Test, Ignore("Changing the original query parameters after FutureValue cause the mix of parameters in SQL.")]
+ [Test, Ignore("Executing FutureValue before Future cause the mix of parameters in SQL.")]
public void WhenUseFutureSkipTakeThenNotThrow()
{
using (var session = OpenSession())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-23 05:27:40
|
Revision: 5053
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5053&view=rev
Author: fabiomaulo
Date: 2010-07-23 05:27:34 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Test for NH-2251
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Domain.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Mappings.hbm.xml
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Domain.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Domain.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Domain.cs 2010-07-23 05:27:34 UTC (rev 5053)
@@ -0,0 +1,10 @@
+using System;
+
+namespace NHibernate.Test.NHSpecificTest.NH2251
+{
+ public class Foo
+ {
+ public virtual Guid Id { get; set; }
+ public virtual string Name { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Fixture.cs 2010-07-23 05:27:34 UTC (rev 5053)
@@ -0,0 +1,51 @@
+using System.Linq;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2251
+{
+ public class Fixture : BugTestCase
+ {
+ [Test, Ignore("Changing the original query parameters after FutureValue cause the mix of parameters in SQL.")]
+ public void WhenUseFutureSkipTakeThenNotThrow()
+ {
+ using (var session = OpenSession())
+ {
+ var query = session.QueryOver<Foo>().Where(o => o.Name == "Graeme");
+
+ var rowcountQuery = query.ToRowCountQuery().FutureValue<int>();
+ var resultsQuery = query.Skip(0).Take(50).Future();
+
+ int rowcount;
+ Foo[] items;
+ Executing.This(() =>
+ {
+ rowcount = rowcountQuery.Value;
+ items = resultsQuery.ToArray();
+ }
+ ).Should().NotThrow();
+ }
+ }
+
+ [Test]
+ public void EnlistingFirstThePaginationAndThenTheRowCountDoesNotThrows()
+ {
+ using (var session = OpenSession())
+ {
+ var query = session.QueryOver<Foo>().Where(o => o.Name == "Graeme");
+
+ var resultsQuery = query.Skip(0).Take(50).Future();
+ var rowcountQuery = query.ToRowCountQuery().FutureValue<int>();
+
+ int rowcount;
+ Foo[] items;
+ Executing.This(() =>
+ {
+ rowcount = rowcountQuery.Value;
+ items = resultsQuery.ToArray();
+ }
+ ).Should().NotThrow();
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2251/Mappings.hbm.xml 2010-07-23 05:27:34 UTC (rev 5053)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2251">
+
+ <class name="Foo">
+ <id name="Id">
+ <generator class="guid" />
+ </id>
+ <property name="Name"/>
+ </class>
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 04:38:56 UTC (rev 5052)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 05:27:34 UTC (rev 5053)
@@ -767,6 +767,8 @@
<Compile Include="NHSpecificTest\NH2242\UnescapedFormulaDomainClass.cs" />
<Compile Include="NHSpecificTest\NH2243\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2243\Person.cs" />
+ <Compile Include="NHSpecificTest\NH2251\Domain.cs" />
+ <Compile Include="NHSpecificTest\NH2251\Fixture.cs" />
<Compile Include="NHSpecificTest\NH473\Child.cs" />
<Compile Include="NHSpecificTest\NH473\Fixture.cs" />
<Compile Include="NHSpecificTest\NH473\Parent.cs" />
@@ -2206,6 +2208,7 @@
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2251\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2041\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2031\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\DateClass.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-23 04:39:06
|
Revision: 5052
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5052&view=rev
Author: fabiomaulo
Date: 2010-07-23 04:38:56 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Fix NH-2041
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs
trunk/nhibernate/src/NHibernate/Mapping/Component.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Domain.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs 2010-07-23 03:51:24 UTC (rev 5051)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs 2010-07-23 04:38:56 UTC (rev 5052)
@@ -114,7 +114,7 @@
else if ((componentMapping = entityPropertyMapping as HbmComponent) != null)
{
string subpath = propertyName == null ? null : StringHelper.Qualify(propertyBasePath, propertyName);
- var value = CreateNewComponent();
+ var value = CreateNewComponent(table);
// NH: Modified from H2.1 to allow specifying the type explicitly using class attribute
System.Type reflectedClass = mappedClass == null ? null : GetPropertyType(componentMapping.Class, mappedClass, propertyName, componentMapping.Access);
BindComponent(componentMapping, value, reflectedClass, entityName, subpath, componetDefaultNullable, inheritedMetas);
@@ -131,7 +131,7 @@
else if ((dynamicComponentMapping = entityPropertyMapping as HbmDynamicComponent) != null)
{
string subpath = propertyName == null ? null : StringHelper.Qualify(propertyBasePath, propertyName);
- var value = CreateNewComponent();
+ var value = CreateNewComponent(table);
// NH: Modified from H2.1 to allow specifying the type explicitly using class attribute
System.Type reflectedClass = mappedClass == null ? null : GetPropertyType(dynamicComponentMapping.Class, mappedClass, propertyName, dynamicComponentMapping.Access);
BindComponent(dynamicComponentMapping, value, reflectedClass, entityName, subpath, componetDefaultNullable, inheritedMetas);
@@ -152,7 +152,7 @@
throw new AssertionFailure("Nested Composite Element without a owner component.");
}
string subpath = propertyName == null ? null : StringHelper.Qualify(propertyBasePath, propertyName);
- var value = CreateNewComponent();
+ var value = CreateNewComponent(table);
// NH: Modified from H2.1 to allow specifying the type explicitly using class attribute
System.Type reflectedClass = mappedClass == null ? null : GetPropertyType(nestedCompositeElementMapping.Class, mappedClass, propertyName, nestedCompositeElementMapping.access);
BindComponent(nestedCompositeElementMapping, value, reflectedClass, entityName, subpath, componetDefaultNullable, inheritedMetas);
@@ -180,10 +180,10 @@
}
}
- private Component CreateNewComponent()
+ private Component CreateNewComponent(Table table)
{
// Manage nested components
- return component != null ? new Component(component) : new Component(persistentClass);
+ return component != null ? new Component(component) : new Component(table, persistentClass);
}
private System.Type GetPropertyType(string classMapping, System.Type containingType, string propertyName, string propertyAccess)
Modified: trunk/nhibernate/src/NHibernate/Mapping/Component.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Mapping/Component.cs 2010-07-23 03:51:24 UTC (rev 5051)
+++ trunk/nhibernate/src/NHibernate/Mapping/Component.cs 2010-07-23 04:38:56 UTC (rev 5052)
@@ -92,18 +92,18 @@
this.owner = owner;
}
+ public Component(Table table, PersistentClass owner)
+ : base(table)
+ {
+ this.owner = owner;
+ }
+
public Component(Collection collection)
: base(collection.CollectionTable)
{
owner = collection.Owner;
}
- public Component(Join join)
- : base(join.Table)
- {
- owner = join.PersistentClass;
- }
-
public Component(Component component)
: base(component.Table)
{
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Domain.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Domain.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Domain.cs 2010-07-23 04:38:56 UTC (rev 5052)
@@ -0,0 +1,13 @@
+namespace NHibernate.Test.NHSpecificTest.NH2041
+{
+ public class MyClass
+ {
+ public Coordinates Location { get; set; }
+ }
+
+ public class Coordinates
+ {
+ public decimal Latitude { get; set; }
+ public decimal Longitude { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Fixture.cs 2010-07-23 04:38:56 UTC (rev 5052)
@@ -0,0 +1,21 @@
+using System.Linq;
+using NUnit.Framework;
+using NHibernate.Cfg;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2041
+{
+ public class Fixture
+ {
+ [Test]
+ public void WhenJoinTableContainComponentsThenColumnsShouldBeInJoinedTable()
+ {
+ Configuration cfg = TestConfigurationHelper.GetDefaultConfiguration();
+ cfg.AddResource("NHibernate.Test.NHSpecificTest.NH2041.Mappings.hbm.xml", GetType().Assembly);
+ var mappings = cfg.CreateMappings(Dialect.Dialect.GetDialect(cfg.Properties));
+ var table = mappings.GetTable(null, null, "Locations");
+ table.Should().Not.Be.Null();
+ table.ColumnIterator.Select(c => c.Name).Should().Have.SameValuesAs("myclassId", "latitudecol", "longitudecol");
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2041/Mappings.hbm.xml 2010-07-23 04:38:56 UTC (rev 5052)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ namespace="NHibernate.Test.NHSpecificTest.NH2041"
+ assembly="NHibernate.Test">
+
+ <class name="MyClass">
+ <id type="int">
+ <generator class="hilo" />
+ </id>
+ <join table="Locations">
+ <key column="myclassId"/>
+ <component name="Location">
+ <property name="Latitude" column="latitudecol"/>
+ <property name="Longitude" column="longitudecol"/>
+ </component>
+ </join>
+ </class>
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 03:51:24 UTC (rev 5051)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 04:38:56 UTC (rev 5052)
@@ -453,6 +453,8 @@
<Compile Include="NHSpecificTest\NH1891\B.cs" />
<Compile Include="NHSpecificTest\NH1891\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2031\HqlModFuctionForMsSqlTest.cs" />
+ <Compile Include="NHSpecificTest\NH2041\Domain.cs" />
+ <Compile Include="NHSpecificTest\NH2041\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2061\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2061\Model.cs" />
<Compile Include="NHSpecificTest\NH2069\Fixture.cs" />
@@ -2204,6 +2206,7 @@
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2041\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2031\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\DateClass.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2207\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-23 03:51:31
|
Revision: 5051
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5051&view=rev
Author: fabiomaulo
Date: 2010-07-23 03:51:24 +0000 (Fri, 23 Jul 2010)
Log Message:
-----------
Fix NH-2166
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2166/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2166/Fixture.cs
Modified: trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs 2010-07-22 20:59:41 UTC (rev 5050)
+++ trunk/nhibernate/src/NHibernate/Exceptions/ADOExceptionHelper.cs 2010-07-23 03:51:24 UTC (rev 5051)
@@ -55,13 +55,13 @@
return Convert(converter, new AdoExceptionContextInfo {SqlException = sqlException, Message = message, Sql = sql});
}
- public static ADOException Convert(ISQLExceptionConverter converter, Exception sqle, string message, SqlString sql,
+ public static Exception Convert(ISQLExceptionConverter converter, Exception sqle, string message, SqlString sql,
object[] parameterValues, IDictionary<string, TypedValue> namedParameters)
{
sql = TryGetActualSqlQuery(sqle, sql);
string extendMessage = ExtendMessage(message, sql != null ? sql.ToString() : null, parameterValues, namedParameters);
ADOExceptionReporter.LogExceptions(sqle, extendMessage);
- return new ADOException(extendMessage, sqle, sql != null ? sql.ToString() : SQLNotAvailable);
+ return Convert(converter, sqle, extendMessage, sql);
}
/// <summary> For the given <see cref="Exception"/>, locates the <see cref="System.Data.Common.DbException"/>. </summary>
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2166/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2166/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2166/Fixture.cs 2010-07-23 03:51:24 UTC (rev 5051)
@@ -0,0 +1,25 @@
+using System;
+using System.Collections;
+using NHibernate.Exceptions;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2166
+{
+ public class Fixture: TestCase
+ {
+ protected override IList Mappings
+ {
+ get { return new string[0]; }
+ }
+
+ [Test]
+ public void WhenUniqueResultShouldCallConverter()
+ {
+ using (var s = OpenSession())
+ {
+ Executing.This(()=> s.CreateSQLQuery("select make from ItFunky").UniqueResult<int>()).Should().Throw<GenericADOException>();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-22 20:59:41 UTC (rev 5050)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-23 03:51:24 UTC (rev 5051)
@@ -470,6 +470,7 @@
<Compile Include="NHSpecificTest\NH2094\Model.cs" />
<Compile Include="NHSpecificTest\NH2102\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2102\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2166\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2189\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2189\Model.cs" />
<Compile Include="NHSpecificTest\ElementsEnums\AbstractIntEnumsBagFixture.cs" />
Modified: trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs 2010-07-22 20:59:41 UTC (rev 5050)
+++ trunk/nhibernate/src/NHibernate.Test/ProjectionFixtures/Fixture.cs 2010-07-23 03:51:24 UTC (rev 5051)
@@ -1,3 +1,4 @@
+using System;
using NHibernate.Criterion;
using NHibernate.Driver;
using NUnit.Framework;
@@ -93,7 +94,7 @@
}
Assert.Fail();
}
- catch (ADOException e)
+ catch (Exception e)
{
if(e.Message != expectedMessage)
throw;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ric...@us...> - 2010-07-22 20:59:48
|
Revision: 5050
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5050&view=rev
Author: ricbrown
Date: 2010-07-22 20:59:41 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Added missing .Not to stand alone lambda restriction.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Criterion/Lambda/LambdaRestrictionBuilder.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Criterion/Lambda/LambdaRestrictionBuilder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Criterion/Lambda/LambdaRestrictionBuilder.cs 2010-07-22 16:54:35 UTC (rev 5049)
+++ trunk/nhibernate/src/NHibernate/Criterion/Lambda/LambdaRestrictionBuilder.cs 2010-07-22 20:59:41 UTC (rev 5050)
@@ -16,21 +16,35 @@
{
private string propertyName;
private object lo;
+ private bool isNot;
- public LambdaBetweenBuilder(string propertyName, object lo)
+ public LambdaBetweenBuilder(string propertyName, object lo, bool isNot)
{
this.propertyName = propertyName;
this.lo = lo;
+ this.isNot = isNot;
}
public AbstractCriterion And(object hi)
{
+ if (isNot)
+ return Restrictions.Not(Restrictions.Between(propertyName, lo, hi));
+
return Restrictions.Between(propertyName, lo, hi);
}
}
private string propertyName;
+ private bool isNot;
+ private ICriterion Process(ICriterion criterion)
+ {
+ if (isNot)
+ return Restrictions.Not(criterion);
+
+ return criterion;
+ }
+
/// <summary>
/// Constructed with property name
/// </summary>
@@ -44,103 +58,112 @@
/// </summary>
public LambdaBetweenBuilder IsBetween(object lo)
{
- return new LambdaBetweenBuilder(propertyName, lo);
+ return new LambdaBetweenBuilder(propertyName, lo, isNot);
}
+ public LambdaRestrictionBuilder Not
+ {
+ get
+ {
+ isNot = !isNot;
+ return this;
+ }
+ }
+
/// <summary>
/// Apply an "in" constraint to the named property
/// </summary>
- public AbstractCriterion IsIn(ICollection values)
+ public ICriterion IsIn(ICollection values)
{
- return Restrictions.In(propertyName, values);
+ return Process(Restrictions.In(propertyName, values));
}
/// <summary>
/// Apply an "in" constraint to the named property
/// </summary>
- public AbstractCriterion IsIn(object[] values)
+ public ICriterion IsIn(object[] values)
{
- return Restrictions.In(propertyName, values);
+ return Process(Restrictions.In(propertyName, values));
}
/// <summary>
/// Apply an "in" constraint to the named property
/// </summary>
- public AbstractCriterion IsInG<T>(ICollection<T> values)
+ public ICriterion IsInG<T>(ICollection<T> values)
{
- return Restrictions.InG(propertyName, values);
+ return Process(Restrictions.InG(propertyName, values));
}
/// <summary>
/// A case-insensitive "like", similar to Postgres "ilike" operator
/// </summary>
- public AbstractCriterion IsInsensitiveLike(object value)
+ public ICriterion IsInsensitiveLike(object value)
{
- return Restrictions.InsensitiveLike(propertyName, value);
+ return Process(Restrictions.InsensitiveLike(propertyName, value));
}
/// <summary>
/// A case-insensitive "like", similar to Postgres "ilike" operator
/// </summary>
- public AbstractCriterion IsInsensitiveLike(string value, MatchMode matchMode)
+ public ICriterion IsInsensitiveLike(string value, MatchMode matchMode)
{
- return Restrictions.InsensitiveLike(propertyName, value, matchMode);
+ return Process(Restrictions.InsensitiveLike(propertyName, value, matchMode));
}
/// <summary>
/// Apply an "is empty" constraint to the named property
/// </summary>
- public AbstractEmptinessExpression IsEmpty
+ public ICriterion IsEmpty
{
- get { return Restrictions.IsEmpty(propertyName); }
+ get { return Process(Restrictions.IsEmpty(propertyName)); }
}
/// <summary>
/// Apply a "not is empty" constraint to the named property
/// </summary>
- public AbstractEmptinessExpression IsNotEmpty
+ public ICriterion IsNotEmpty
{
- get { return Restrictions.IsNotEmpty(propertyName); }
+ get { return Process(Restrictions.IsNotEmpty(propertyName)); }
}
/// <summary>
/// Apply an "is null" constraint to the named property
/// </summary>
- public AbstractCriterion IsNull
+ public ICriterion IsNull
{
- get { return Restrictions.IsNull(propertyName); }
+ get { return Process(Restrictions.IsNull(propertyName)); }
}
/// <summary>
/// Apply an "not is null" constraint to the named property
/// </summary>
- public AbstractCriterion IsNotNull
+ public ICriterion IsNotNull
{
- get { return Restrictions.IsNotNull(propertyName); }
+ get { return Process(Restrictions.IsNotNull(propertyName)); }
}
/// <summary>
/// Apply a "like" constraint to the named property
/// </summary>
- public SimpleExpression IsLike(object value)
+ public ICriterion IsLike(object value)
{
- return Restrictions.Like(propertyName, value);
+ return Process(Restrictions.Like(propertyName, value));
}
/// <summary>
/// Apply a "like" constraint to the named property
/// </summary>
- public SimpleExpression IsLike(string value, MatchMode matchMode)
+ public ICriterion IsLike(string value, MatchMode matchMode)
{
- return Restrictions.Like(propertyName, value, matchMode);
+ return Process(Restrictions.Like(propertyName, value, matchMode));
}
/// <summary>
/// Apply a "like" constraint to the named property
/// </summary>
- public AbstractCriterion IsLike(string value, MatchMode matchMode, char? escapeChar)
+ public ICriterion IsLike(string value, MatchMode matchMode, char? escapeChar)
{
- return Restrictions.Like(propertyName, value, matchMode, escapeChar);
+ return Process(Restrictions.Like(propertyName, value, matchMode, escapeChar));
}
}
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs 2010-07-22 16:54:35 UTC (rev 5049)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs 2010-07-22 20:59:41 UTC (rev 5050)
@@ -40,12 +40,14 @@
CreateTestCriteria(typeof(Person), "personAlias")
.Add(Restrictions.Between("Age", 18, 65))
.Add(Restrictions.Between("personAlias.Age", 18, 65))
+ .Add(Restrictions.Not(Restrictions.Between("personAlias.Age", 10, 20)))
.Add(Restrictions.In("Name", new string[] { "name1", "name2", "name3" }))
.Add(Restrictions.In("Name", new ArrayList() { "name1", "name2", "name3" }))
.Add(Restrictions.InG<int>("Age", new int[] { 1, 2, 3 }))
.Add(Restrictions.InsensitiveLike("Name", "test"))
.Add(Restrictions.InsensitiveLike("Name", "tEsT", MatchMode.Anywhere))
.Add(Restrictions.IsEmpty("Children"))
+ .Add(Restrictions.Not(Restrictions.IsEmpty("Children")))
.Add(Restrictions.IsNotEmpty("Children"))
.Add(Restrictions.IsNotNull("Name"))
.Add(Restrictions.IsNull("Name"))
@@ -61,12 +63,14 @@
CreateTestQueryOver<Person>(() => personAlias)
.Where(Restrictions.On<Person>(p => p.Age).IsBetween(18).And(65))
.And(Restrictions.On(() => personAlias.Age).IsBetween(18).And(65))
+ .And(Restrictions.On(() => personAlias.Age).Not.IsBetween(10).And(20))
.And(Restrictions.On<Person>(p => p.Name).IsIn(new string[] { "name1", "name2", "name3" }))
.And(Restrictions.On<Person>(p => p.Name).IsIn(new ArrayList() { "name1", "name2", "name3" }))
.And(Restrictions.On<Person>(p => p.Age).IsInG<int>(new int[] { 1, 2, 3 }))
.And(Restrictions.On<Person>(p => p.Name).IsInsensitiveLike("test"))
.And(Restrictions.On<Person>(p => p.Name).IsInsensitiveLike("tEsT", MatchMode.Anywhere))
.And(Restrictions.On<Person>(p => p.Children).IsEmpty)
+ .And(Restrictions.On<Person>(p => p.Children).Not.IsEmpty)
.And(Restrictions.On<Person>(p => p.Children).IsNotEmpty)
.And(Restrictions.On<Person>(p => p.Name).IsNotNull)
.And(Restrictions.On<Person>(p => p.Name).IsNull)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 17:13:27
|
Revision: 5041
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5041&view=rev
Author: fabiomaulo
Date: 2010-07-22 13:34:19 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Missed 'unique' specification on component mapping
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs 2010-07-22 12:05:41 UTC (rev 5040)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs 2010-07-22 13:34:19 UTC (rev 5041)
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Mapping;
using System;
@@ -117,7 +118,7 @@
System.Type reflectedClass = mappedClass == null ? null : GetPropertyType(componentMapping.Class, mappedClass, propertyName, componentMapping.Access);
BindComponent(componentMapping, value, reflectedClass, entityName, subpath, componetDefaultNullable, inheritedMetas);
property = CreateProperty(entityPropertyMapping, className, value, inheritedMetas);
- BindComponentProperty(componentMapping, property);
+ BindComponentProperty(componentMapping, property, value);
}
else if ((oneToOneMapping = entityPropertyMapping as HbmOneToOne) != null)
{
@@ -134,7 +135,7 @@
System.Type reflectedClass = mappedClass == null ? null : GetPropertyType(dynamicComponentMapping.Class, mappedClass, propertyName, dynamicComponentMapping.Access);
BindComponent(dynamicComponentMapping, value, reflectedClass, entityName, subpath, componetDefaultNullable, inheritedMetas);
property = CreateProperty(entityPropertyMapping, className, value, inheritedMetas);
- BindComponentProperty(dynamicComponentMapping, property);
+ BindComponentProperty(dynamicComponentMapping, property, value);
}
else if ((anyMapping = entityPropertyMapping as HbmAny) != null)
{
@@ -314,16 +315,24 @@
}
}
- private void BindComponentProperty(HbmDynamicComponent dynamicComponentMapping, Property property)
+ private void BindComponentProperty(HbmDynamicComponent dynamicComponentMapping, Property property, Component model)
{
property.IsUpdateable = dynamicComponentMapping.update;
property.IsInsertable = dynamicComponentMapping.insert;
+ if (dynamicComponentMapping.unique)
+ {
+ model.Owner.Table.CreateUniqueKey(model.ColumnIterator.OfType<Column>().ToList());
+ }
}
- private void BindComponentProperty(HbmComponent componentMapping, Property property)
+ private void BindComponentProperty(HbmComponent componentMapping, Property property, Component model)
{
property.IsUpdateable = componentMapping.update;
property.IsInsertable = componentMapping.insert;
+ if (componentMapping.unique)
+ {
+ model.Owner.Table.CreateUniqueKey(model.ColumnIterator.OfType<Column>().ToList());
+ }
}
private void BindManyToOneProperty(HbmManyToOne manyToOneMapping, Property property)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 16:54:41
|
Revision: 5049
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5049&view=rev
Author: fabiomaulo
Date: 2010-07-22 16:54:35 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2013
Modified Paths:
--------------
trunk/nhibernate/doc/reference/modules/query_hql.xml
Modified: trunk/nhibernate/doc/reference/modules/query_hql.xml
===================================================================
--- trunk/nhibernate/doc/reference/modules/query_hql.xml 2010-07-22 16:50:49 UTC (rev 5048)
+++ trunk/nhibernate/doc/reference/modules/query_hql.xml 2010-07-22 16:54:35 UTC (rev 5049)
@@ -137,9 +137,7 @@
left join fetch cat.Kittens]]></programlisting>
<para>
- A fetch join does not usually need to assign an alias, because the associated objects
- should not be used in the <literal>where</literal> clause (or any other clause). Also,
- the associated objects are not returned directly in the query results. Instead, they may
+ The associated objects are not returned directly in the query results. Instead, they may
be accessed via the parent object.
</para>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 16:50:56
|
Revision: 5048
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5048&view=rev
Author: fabiomaulo
Date: 2010-07-22 16:50:49 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2031 (thanks to Andrea Balducci)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/HqlModFuctionForMsSqlTest.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/Mappings.hbm.xml
Modified: trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2010-07-22 16:10:05 UTC (rev 5047)
+++ trunk/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs 2010-07-22 16:50:49 UTC (rev 5048)
@@ -94,7 +94,7 @@
RegisterFunction("ln", new StandardSQLFunction("ln", NHibernateUtil.Double));
RegisterFunction("log", new StandardSQLFunction("log", NHibernateUtil.Double));
RegisterFunction("log10", new StandardSQLFunction("log10", NHibernateUtil.Double));
- RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "(?1 % ?2)"));
+ RegisterFunction("mod", new SQLFunctionTemplate(NHibernateUtil.Int32, "((?1) % (?2))"));
RegisterFunction("radians", new StandardSQLFunction("radians", NHibernateUtil.Double));
RegisterFunction("rand", new NoArgSQLFunction("rand", NHibernateUtil.Double));
RegisterFunction("sin", new StandardSQLFunction("sin", NHibernateUtil.Double));
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/HqlModFuctionForMsSqlTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/HqlModFuctionForMsSqlTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/HqlModFuctionForMsSqlTest.cs 2010-07-22 16:50:49 UTC (rev 5048)
@@ -0,0 +1,35 @@
+using NHibernate.Dialect;
+using NHibernate.Hql.Ast.ANTLR;
+using NHibernate.Util;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2031
+{
+ public class MyClass
+ {
+
+ }
+ public class HqlModFuctionForMsSqlTest : BugTestCase
+ {
+ protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect)
+ {
+ return dialect is MsSql2000Dialect;
+ }
+
+ [Test]
+ public void TheModuleOperationShouldAddParenthesisToAvoidWrongSentence()
+ {
+ // The expected value should be "(5+1)%(1+1)" instead "5+ 1%1 +1"
+ var sqlQuery = GetSql("select mod(5+1,1+1) from MyClass");
+ sqlQuery.Should().Contain("(5+1)").And.Contain("(1+1)");
+ }
+
+ public string GetSql(string query)
+ {
+ var qt = new QueryTranslatorImpl(null, new HqlParseEngine(query, false, sessions).Parse(), new CollectionHelper.EmptyMapClass<string, IFilter>(), sessions);
+ qt.Compile(null, false);
+ return qt.SQLString;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2031/Mappings.hbm.xml 2010-07-22 16:50:49 UTC (rev 5048)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ namespace="NHibernate.Test.NHSpecificTest.NH2031"
+ assembly="NHibernate.Test">
+
+ <class name="MyClass">
+ <id type="int">
+ <generator class="hilo" />
+ </id>
+ </class>
+</hibernate-mapping>
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-22 16:10:05 UTC (rev 5047)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-22 16:50:49 UTC (rev 5048)
@@ -452,6 +452,7 @@
<Compile Include="NHSpecificTest\NH1891\A.cs" />
<Compile Include="NHSpecificTest\NH1891\B.cs" />
<Compile Include="NHSpecificTest\NH1891\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH2031\HqlModFuctionForMsSqlTest.cs" />
<Compile Include="NHSpecificTest\NH2061\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2061\Model.cs" />
<Compile Include="NHSpecificTest\NH2069\Fixture.cs" />
@@ -2202,6 +2203,7 @@
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2031\Mappings.hbm.xml" />
<EmbeddedResource Include="TypesTest\DateClass.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2207\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2243\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 16:10:12
|
Revision: 5047
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5047&view=rev
Author: fabiomaulo
Date: 2010-07-22 16:10:05 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2083
Modified Paths:
--------------
trunk/nhibernate/doc/reference/modules/basic_mapping.xml
Modified: trunk/nhibernate/doc/reference/modules/basic_mapping.xml
===================================================================
--- trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-07-22 15:56:09 UTC (rev 5046)
+++ trunk/nhibernate/doc/reference/modules/basic_mapping.xml 2010-07-22 16:10:05 UTC (rev 5047)
@@ -102,13 +102,18 @@
<area id="hm3" coords="4 55"/>
<area id="hm4" coords="5 55"/>
<area id="hm5" coords="6 55"/>
+ <area id="hm6" coords="7 55"/>
+ <area id="hm7" coords="8 55"/>
</areaspec>
- <programlisting><![CDATA[<hibernate-mapping
+ <programlisting>
+ <![CDATA[<hibernate-mapping
schema="schemaName"
default-cascade="none|save-update"
auto-import="true|false"
assembly="Eg"
namespace="Eg"
+ default-access="field|property|field.camecase..."
+ default-lazy="true|false"
/>]]></programlisting>
<calloutlist>
<callout arearefs="hm1">
@@ -136,6 +141,18 @@
document.
</para>
</callout>
+ <callout arearefs="hm6">
+ <para>
+ <literal>default-access</literal> (optional - defaults to property):
+ The strategy NHibernate should use for accessing a property value
+ </para>
+ </callout>
+ <callout arearefs="hm7">
+ <para>
+ <literal>default-lazy</literal> (optional - defaults to <literal>true</literal>):
+ Lazy fetching may be completely disabled by setting default-lazy="false".
+ </para>
+ </callout>
</calloutlist>
</programlistingco>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 15:56:15
|
Revision: 5046
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5046&view=rev
Author: fabiomaulo
Date: 2010-07-22 15:56:09 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Check that NH-2168 was fixed in the trunk
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs
Modified: trunk/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs 2010-07-22 15:40:21 UTC (rev 5045)
+++ trunk/nhibernate/src/NHibernate.Test/Stats/StatsFixture.cs 2010-07-22 15:56:09 UTC (rev 5046)
@@ -158,7 +158,7 @@
Assert.AreEqual(results, continentStats.ExecutionRowCount, "unexpected row count");
var maxTime = continentStats.ExecutionMaxTime;
Assert.AreEqual(maxTime, stats.QueryExecutionMaxTime);
- //Assert.AreEqual( continents, stats.QueryExecutionMaxTimeQueryString );
+ Assert.AreEqual( continents, stats.QueryExecutionMaxTimeQueryString );
IEnumerable itr = s.CreateQuery(continents).Enumerable();
// Enumerable() should increment the execution count
@@ -183,7 +183,7 @@
Assert.AreEqual(results, localityStats.ExecutionRowCount, "unexpected row count");
maxTime = localityStats.ExecutionMaxTime;
Assert.AreEqual(maxTime, stats.QueryExecutionMaxTime);
- // Assert.AreEqual( localities, stats.QueryExecutionMaxTimeQueryString );
+ Assert.AreEqual( localities, stats.QueryExecutionMaxTimeQueryString );
tx.Commit();
s.Close();
Assert.IsFalse(s.IsOpen);
@@ -200,7 +200,7 @@
Assert.AreEqual(results, sqlStats.ExecutionRowCount, "unexpected row count");
maxTime = sqlStats.ExecutionMaxTime;
Assert.AreEqual(maxTime, stats.QueryExecutionMaxTime);
- // Assert.AreEqual( sql, stats.QueryExecutionMaxTimeQueryString);
+ Assert.AreEqual( sql, stats.QueryExecutionMaxTimeQueryString);
tx.Commit();
s.Close();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 15:40:27
|
Revision: 5045
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5045&view=rev
Author: fabiomaulo
Date: 2010-07-22 15:40:21 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Removed unused files
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.sln
Modified: trunk/nhibernate/src/NHibernate.sln
===================================================================
--- trunk/nhibernate/src/NHibernate.sln 2010-07-22 15:39:51 UTC (rev 5044)
+++ trunk/nhibernate/src/NHibernate.sln 2010-07-22 15:40:21 UTC (rev 5045)
@@ -3,8 +3,6 @@
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{593DCEA7-C933-46F3-939F-D8172399AB05}"
ProjectSection(SolutionItems) = preProject
..\default.build = ..\default.build
- LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
- NHibernate.vsmdi = NHibernate.vsmdi
..\releasenotes.txt = ..\releasenotes.txt
EndProjectSection
EndProject
@@ -20,16 +18,11 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.ByteCode.Castle", "NHibernate.ByteCode.Castle\NHibernate.ByteCode.Castle.csproj", "{31C3F0EA-0FED-4A2F-B68D-96CE29844487}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.ByteCode.Spring", "NHibernate.ByteCode.Spring\NHibernate.ByteCode.Spring.csproj", "{946BCA10-109A-4472-8521-76616174AD4D}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.ByteCode.Castle.Tests", "NHibernate.ByteCode.Castle.Tests\NHibernate.ByteCode.Castle.Tests.csproj", "{4972EE96-2417-4D47-9FF1-3B1D6B1D3191}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.TestDatabaseSetup", "NHibernate.TestDatabaseSetup\NHibernate.TestDatabaseSetup.csproj", "{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}"
EndProject
Global
- GlobalSection(TestCaseManagementSettings) = postSolution
- CategoryFile = NHibernate.vsmdi
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@@ -59,10 +52,6 @@
{31C3F0EA-0FED-4A2F-B68D-96CE29844487}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31C3F0EA-0FED-4A2F-B68D-96CE29844487}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31C3F0EA-0FED-4A2F-B68D-96CE29844487}.Release|Any CPU.Build.0 = Release|Any CPU
- {946BCA10-109A-4472-8521-76616174AD4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {946BCA10-109A-4472-8521-76616174AD4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {946BCA10-109A-4472-8521-76616174AD4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {946BCA10-109A-4472-8521-76616174AD4D}.Release|Any CPU.Build.0 = Release|Any CPU
{4972EE96-2417-4D47-9FF1-3B1D6B1D3191}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4972EE96-2417-4D47-9FF1-3B1D6B1D3191}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4972EE96-2417-4D47-9FF1-3B1D6B1D3191}.Release|Any CPU.ActiveCfg = Release|Any CPU
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 15:39:57
|
Revision: 5044
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5044&view=rev
Author: fabiomaulo
Date: 2010-07-22 15:39:51 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2219
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs
trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs
Modified: trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs 2010-07-22 14:21:58 UTC (rev 5043)
+++ trunk/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs 2010-07-22 15:39:51 UTC (rev 5044)
@@ -123,14 +123,8 @@
public SqlUpdateBuilder AppendAssignmentFragment(SqlString fragment)
{
- if (assignments == null)
- {
- assignments = fragment;
- }
- else
- {
- assignments.Append(", ").Append(fragment);
- }
+ // SqlString is immutable
+ assignments = assignments == null ? fragment : assignments.Append(", ").Append(fragment);
return this;
}
Modified: trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2010-07-22 14:21:58 UTC (rev 5043)
+++ trunk/nhibernate/src/NHibernate.Test/HQL/Ast/BulkManipulation.cs 2010-07-22 15:39:51 UTC (rev 5044)
@@ -6,6 +6,7 @@
using NHibernate.Id;
using NHibernate.Persister.Entity;
using NUnit.Framework;
+using SharpTestsEx;
namespace NHibernate.Test.HQL.Ast
{
@@ -609,6 +610,37 @@
}
[Test]
+ public void UpdateMultiplePropertyOnAnimal()
+ {
+ var data = new TestData(this);
+ data.Prepare();
+
+ using (ISession s = OpenSession())
+ using (ITransaction t = s.BeginTransaction())
+ {
+ int count =
+ s.CreateQuery("update Animal set description = :newDesc, bodyWeight = :w1 where description = :desc")
+ .SetString("desc", data.Polliwog.Description)
+ .SetString("newDesc", "Tadpole")
+ .SetDouble("w1", 3)
+ .ExecuteUpdate();
+
+ count.Should().Be(1);
+ t.Commit();
+ }
+
+ using (ISession s = OpenSession())
+ using (s.BeginTransaction())
+ {
+ var tadpole = s.Get<Animal>(data.Polliwog.Id);
+ tadpole.Description.Should().Be("Tadpole");
+ tadpole.BodyWeight.Should().Be(3);
+ }
+
+ data.Cleanup();
+ }
+
+ [Test]
public void UpdateOnMammal()
{
var data = new TestData(this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 14:22:06
|
Revision: 5043
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5043&view=rev
Author: fabiomaulo
Date: 2010-07-22 14:21:58 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Minor (performance test running explicitly)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/SessionIdLoggingContextTest/PerfTest.cs
Modified: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/SessionIdLoggingContextTest/PerfTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/SessionIdLoggingContextTest/PerfTest.cs 2010-07-22 14:19:50 UTC (rev 5042)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/SessionIdLoggingContextTest/PerfTest.cs 2010-07-22 14:21:58 UTC (rev 5043)
@@ -7,7 +7,7 @@
namespace NHibernate.Test.NHSpecificTest.SessionIdLoggingContextTest
{
- [TestFixture]
+ [TestFixture, Explicit("This is a performance test and take a while.")]
public class PerfTest : BugTestCase
{
const int noOfParents = 1000;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 14:19:56
|
Revision: 5042
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5042&view=rev
Author: fabiomaulo
Date: 2010-07-22 14:19:50 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2221
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs
trunk/nhibernate/src/NHibernate/NHibernate.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/MappingExtensions.cs
Added: trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/MappingExtensions.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/MappingExtensions.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate/Cfg/MappingSchema/MappingExtensions.cs 2010-07-22 14:19:50 UTC (rev 5042)
@@ -0,0 +1,22 @@
+using System;
+
+namespace NHibernate.Cfg.MappingSchema
+{
+ public static class MappingExtensions
+ {
+ public static EntityMode ToEntityMode(this HbmTuplizerEntitymode source)
+ {
+ switch (source)
+ {
+ case HbmTuplizerEntitymode.Poco:
+ return EntityMode.Poco;
+ case HbmTuplizerEntitymode.Xml:
+ return EntityMode.Xml;
+ case HbmTuplizerEntitymode.DynamicMap:
+ return EntityMode.Map;
+ default:
+ throw new ArgumentOutOfRangeException("source");
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs 2010-07-22 13:34:19 UTC (rev 5041)
+++ trunk/nhibernate/src/NHibernate/Cfg/XmlHbmBinding/PropertiesBinder.cs 2010-07-22 14:19:50 UTC (rev 5042)
@@ -4,6 +4,7 @@
using NHibernate.Mapping;
using System;
using NHibernate.Util;
+using Array = System.Array;
namespace NHibernate.Cfg.XmlHbmBinding
{
@@ -333,6 +334,16 @@
{
model.Owner.Table.CreateUniqueKey(model.ColumnIterator.OfType<Column>().ToList());
}
+ HbmTuplizer[] tuplizers = componentMapping.tuplizer;
+ if (tuplizers != null)
+ {
+ Array.ForEach(tuplizers.Select(tuplizer => new
+ {
+ TuplizerClassName = FullQualifiedClassName(tuplizer.@class, mappings),
+ Mode = tuplizer.entitymode.ToEntityMode()
+ }).ToArray(),
+ x => model.AddTuplizer(x.Mode, x.TuplizerClassName));
+ }
}
private void BindManyToOneProperty(HbmManyToOne manyToOneMapping, Property property)
Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-07-22 13:34:19 UTC (rev 5041)
+++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2010-07-22 14:19:50 UTC (rev 5042)
@@ -547,6 +547,7 @@
<Compile Include="Cfg\MappingSchema\IReferencePropertyMapping.cs" />
<Compile Include="Cfg\MappingSchema\IRelationship.cs" />
<Compile Include="Cfg\MappingSchema\ITypeMapping.cs" />
+ <Compile Include="Cfg\MappingSchema\MappingExtensions.cs" />
<Compile Include="Cfg\SchemaAutoAction.cs" />
<Compile Include="Cfg\SessionFactoryConfigurationBase.cs" />
<Compile Include="Cfg\ISessionFactoryConfiguration.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 12:05:47
|
Revision: 5040
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5040&view=rev
Author: fabiomaulo
Date: 2010-07-22 12:05:41 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2247
Modified Paths:
--------------
trunk/nhibernate/doc/reference/modules/manipulating_data.xml
Modified: trunk/nhibernate/doc/reference/modules/manipulating_data.xml
===================================================================
--- trunk/nhibernate/doc/reference/modules/manipulating_data.xml 2010-07-22 05:39:46 UTC (rev 5039)
+++ trunk/nhibernate/doc/reference/modules/manipulating_data.xml 2010-07-22 12:05:41 UTC (rev 5040)
@@ -772,7 +772,8 @@
It is possible to change the default behavior so that flush occurs less frequently.
The <literal>FlushMode</literal> class defines three different modes:
only flush at commit time (and only when the NHibernate <literal>ITransaction</literal>
- API is used), flush automatically using the explained routine, or never flush unless
+ API is used), flush automatically using the explained routine (will only work inside an explicit NHibernate <literal>ITransaction</literal>),
+ or never flush unless
<literal>Flush()</literal> is called explicitly. The last mode is useful for long
running units of work, where an ISession is kept open and disconnected for a long time
(see <xref linkend="transactions-optimistic" />).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 05:39:52
|
Revision: 5039
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5039&view=rev
Author: fabiomaulo
Date: 2010-07-22 05:39:46 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Second part of NH-2216
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Type/EnumStringType.cs
Modified: trunk/nhibernate/src/NHibernate/Type/EnumStringType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/EnumStringType.cs 2010-07-22 05:36:15 UTC (rev 5038)
+++ trunk/nhibernate/src/NHibernate/Type/EnumStringType.cs 2010-07-22 05:39:46 UTC (rev 5039)
@@ -221,6 +221,18 @@
[Serializable]
public class EnumStringType<T> : EnumStringType
{
- public EnumStringType() : base(typeof (T)) {}
+ private readonly string typeName;
+
+ public EnumStringType()
+ : base(typeof (T))
+ {
+ System.Type type = GetType();
+ typeName = type.FullName + ", " + type.Assembly.GetName().Name;
+ }
+
+ public override string Name
+ {
+ get { return typeName; }
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 05:36:21
|
Revision: 5038
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5038&view=rev
Author: fabiomaulo
Date: 2010-07-22 05:36:15 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Refactor (for EnumType<T>)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/NHibernateUtil.cs
Modified: trunk/nhibernate/src/NHibernate/NHibernateUtil.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2010-07-22 04:57:07 UTC (rev 5037)
+++ trunk/nhibernate/src/NHibernate/NHibernateUtil.cs 2010-07-22 05:36:15 UTC (rev 5038)
@@ -51,7 +51,7 @@
/// <returns></returns>
public static IType GuessType(System.Type type)
{
- if(type.FullName.StartsWith(typeof(Nullable<>).FullName))
+ if(type.IsGenericType && typeof(Nullable<>).Equals(type.GetGenericTypeDefinition()))
{
type = type.GetGenericArguments()[0];
}
@@ -61,7 +61,7 @@
}
else if (type.IsEnum)
{
- return Enum(type);
+ return (IType) Activator.CreateInstance(typeof (EnumType<>).MakeGenericType(type));
}
else if (
typeof(IUserType).IsAssignableFrom(type) ||
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 04:57:13
|
Revision: 5037
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5037&view=rev
Author: fabiomaulo
Date: 2010-07-22 04:57:07 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2216
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Type/PersistentEnumType.cs
trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs
trunk/nhibernate/src/NHibernate.Test/GenericTest/EnumGeneric/EnumGenericFixture.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumClass.hbm.xml
trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumTypeFixture.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Type/PersistentEnumType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/PersistentEnumType.cs 2010-07-22 03:55:22 UTC (rev 5036)
+++ trunk/nhibernate/src/NHibernate/Type/PersistentEnumType.cs 2010-07-22 04:57:07 UTC (rev 5037)
@@ -279,6 +279,22 @@
{
return ReturnedClass.GetHashCode();
}
+ }
+ [Serializable]
+ public class EnumType<T> : PersistentEnumType
+ {
+ private readonly string typeName;
+
+ public EnumType() : base(typeof (T))
+ {
+ System.Type type = GetType();
+ typeName = type.FullName + ", " + type.Assembly.GetName().Name;
+ }
+
+ public override string Name
+ {
+ get { return typeName; }
+ }
}
}
Modified: trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2010-07-22 03:55:22 UTC (rev 5036)
+++ trunk/nhibernate/src/NHibernate/Type/TypeFactory.cs 2010-07-22 04:57:07 UTC (rev 5037)
@@ -498,11 +498,11 @@
}
else if (typeClass.IsEnum)
{
- type = NHibernateUtil.Enum(typeClass);
+ type = (IType) Activator.CreateInstance(typeof (EnumType<>).MakeGenericType(typeClass));
}
else if (IsNullableEnum(typeClass))
{
- type = NHibernateUtil.Enum(typeClass.GetGenericArguments()[0]);
+ type = (IType)Activator.CreateInstance(typeof(EnumType<>).MakeGenericType(typeClass.GetGenericArguments()[0]));
}
else if (typeClass.IsSerializable)
{
Modified: trunk/nhibernate/src/NHibernate.Test/GenericTest/EnumGeneric/EnumGenericFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/GenericTest/EnumGeneric/EnumGenericFixture.cs 2010-07-22 03:55:22 UTC (rev 5036)
+++ trunk/nhibernate/src/NHibernate.Test/GenericTest/EnumGeneric/EnumGenericFixture.cs 2010-07-22 04:57:07 UTC (rev 5037)
@@ -4,6 +4,7 @@
using NHibernate.Persister.Entity;
using NHibernate.Type;
using NUnit.Framework;
+using SharpTestsEx;
namespace NHibernate.Test.GenericTest.EnumGeneric
{
@@ -44,7 +45,7 @@
if (index == -1) Assert.Fail("Property NullableValue not found.");
- Assert.AreEqual(typeof (PersistentEnumType), persister.PropertyTypes[index].GetType());
+ persister.PropertyTypes[index].Should().Be.AssignableTo<PersistentEnumType>();
}
}
Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumClass.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumClass.hbm.xml 2010-07-22 03:55:22 UTC (rev 5036)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumClass.hbm.xml 2010-07-22 04:57:07 UTC (rev 5037)
@@ -12,6 +12,6 @@
</id>
<property name="A" />
- <property name="B" />
+ <property name="B" type="NHibernate.Type.EnumType`1[[NHibernate.Test.TypesTest.B, NHibernate.Test]], NHibernate" />
</class>
</hibernate-mapping>
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumTypeFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumTypeFixture.cs 2010-07-22 03:55:22 UTC (rev 5036)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/PersistentEnumTypeFixture.cs 2010-07-22 04:57:07 UTC (rev 5037)
@@ -1,6 +1,7 @@
using System;
using NHibernate.Type;
using NUnit.Framework;
+using SharpTestsEx;
namespace NHibernate.Test.TypesTest
{
@@ -114,5 +115,35 @@
s2.Close();
}
}
+
+ [Test]
+ public void CanWriteAndReadUsingBothHeuristicAndExplicitGenericDeclaration()
+ {
+ var persistentEnumClass = new PersistentEnumClass {Id = 1, A = A.Two, B = B.One};
+ using (ISession s = OpenSession())
+ {
+ s.Save(persistentEnumClass);
+ s.Flush();
+ }
+
+ using (ISession s = sessions.OpenSession())
+ {
+ var saved = s.Get<PersistentEnumClass>(1);
+ saved.A.Should().Be(A.Two);
+ saved.B.Should().Be(B.One);
+ s.Delete(saved);
+ s.Flush();
+ }
+ }
}
+
+ public class GenericEnumTypeTest
+ {
+ [Test]
+ public void TheNameShouldBeFullNameAndAssembly()
+ {
+ var enumType = new EnumType<B>();
+ enumType.Name.Should().Be(typeof(EnumType<B>).FullName + ", NHibernate");
+ }
+ }
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs 2010-07-22 03:55:22 UTC (rev 5036)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs 2010-07-22 04:57:07 UTC (rev 5037)
@@ -3,6 +3,7 @@
using log4net.Repository.Hierarchy;
using NHibernate.Type;
using NUnit.Framework;
+using SharpTestsEx;
namespace NHibernate.Test.TypesTest
{
@@ -138,5 +139,24 @@
Assert.That(singleType, Is.SameAs(TypeFactory.Basic("Single(10,5)")));
Assert.That(singleType, Is.Not.SameAs(TypeFactory.Basic("Single(11,5)")));
}
+
+ public enum MyEnum
+ {
+ One
+ }
+
+ [Test]
+ public void WhenUseEnumThenReturnGenericEnumType()
+ {
+ var iType = TypeFactory.HeuristicType(typeof (MyEnum).AssemblyQualifiedName);
+ iType.Should().Be.OfType<EnumType<MyEnum>>();
+ }
+
+ [Test]
+ public void WhenUseNullableEnumThenReturnGenericEnumType()
+ {
+ var iType = TypeFactory.HeuristicType(typeof(MyEnum?).AssemblyQualifiedName);
+ iType.Should().Be.OfType<EnumType<MyEnum>>();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-22 03:55:28
|
Revision: 5036
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5036&view=rev
Author: fabiomaulo
Date: 2010-07-22 03:55:22 +0000 (Thu, 22 Jul 2010)
Log Message:
-----------
Fix NH-2249
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Type/DateType.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.cs
trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.hbm.xml
trunk/nhibernate/src/NHibernate.Test/TypesTest/DateTypeTest.cs
Modified: trunk/nhibernate/src/NHibernate/Type/DateType.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Type/DateType.cs 2010-07-21 20:58:52 UTC (rev 5035)
+++ trunk/nhibernate/src/NHibernate/Type/DateType.cs 2010-07-22 03:55:22 UTC (rev 5036)
@@ -1,6 +1,8 @@
using System;
+using System.Collections.Generic;
using System.Data;
using NHibernate.SqlTypes;
+using NHibernate.UserTypes;
namespace NHibernate.Type
{
@@ -9,12 +11,14 @@
/// <see cref="DbType.Date"/> column
/// </summary>
[Serializable]
- public class DateType : PrimitiveType, IIdentifierType, ILiteralType
+ public class DateType : PrimitiveType, IIdentifierType, ILiteralType, IParameterizedType
{
- private static readonly DateTime BaseDateValue = new DateTime(1753, 01, 01);
+ public const string BaseValueParameterName = "BaseValue";
+ public static readonly DateTime BaseDateValue = new DateTime(1753, 01, 01);
+ private DateTime customBaseDate = BaseDateValue;
/// <summary></summary>
- internal DateType() : base(SqlTypeFactory.Date)
+ public DateType() : base(SqlTypeFactory.Date)
{
}
@@ -29,7 +33,7 @@
try
{
DateTime dbValue = Convert.ToDateTime(rs[index]);
- return new DateTime(dbValue.Year, dbValue.Month, dbValue.Day);
+ return dbValue.Date;
}
catch (Exception ex)
{
@@ -51,7 +55,7 @@
{
var parm = st.Parameters[index] as IDataParameter;
var dateTime = (DateTime)value;
- if (dateTime < BaseDateValue)
+ if (dateTime < customBaseDate)
{
parm.Value = DBNull.Value;
}
@@ -118,12 +122,25 @@
public override object DefaultValue
{
- get { return BaseDateValue; }
+ get { return customBaseDate; }
}
public override string ObjectToSQLString(object value, Dialect.Dialect dialect)
{
return '\'' + ((DateTime)value).ToShortDateString() + '\'';
}
+
+ public void SetParameterValues(IDictionary<string, string> parameters)
+ {
+ if(parameters == null)
+ {
+ return;
+ }
+ string value;
+ if (parameters.TryGetValue(BaseValueParameterName, out value))
+ {
+ customBaseDate = DateTime.Parse(value);
+ }
+ }
}
}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 20:58:52 UTC (rev 5035)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-22 03:55:22 UTC (rev 5036)
@@ -1525,6 +1525,8 @@
<Compile Include="TypesTest\ByteTypeFixture.cs" />
<Compile Include="TypesTest\CurrencyClass.cs" />
<Compile Include="TypesTest\CurrencyTypeFixture.cs" />
+ <Compile Include="TypesTest\DateClass.cs" />
+ <Compile Include="TypesTest\DateTypeTest.cs" />
<Compile Include="TypesTest\TimeAsTimeSpanClass.cs" />
<Compile Include="TypesTest\TimeAsTimeSpanTypeFixture.cs" />
<Compile Include="TypesTest\TimeSpanClass.cs" />
@@ -2200,6 +2202,7 @@
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="TypesTest\DateClass.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2207\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2243\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1891\FormulaEscaping.hbm.xml" />
Added: trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.cs 2010-07-22 03:55:22 UTC (rev 5036)
@@ -0,0 +1,9 @@
+using System;
+
+namespace NHibernate.Test.TypesTest
+{
+ public class DateClass
+ {
+ public DateTime? DateValue { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/DateClass.hbm.xml 2010-07-22 03:55:22 UTC (rev 5036)
@@ -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.TypesTest"
+ default-lazy="false">
+
+ <class name="DateClass">
+ <id type="int">
+ <generator class="native" />
+ </id>
+ <property name="DateValue">
+ <type name="NHibernate.Type.DateType, NHibernate">
+ <param name="BaseValue">1900/01/01</param>
+ </type>
+ </property>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/TypesTest/DateTypeTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/TypesTest/DateTypeTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/TypesTest/DateTypeTest.cs 2010-07-22 03:55:22 UTC (rev 5036)
@@ -0,0 +1,93 @@
+using System.Collections.Generic;
+using NHibernate.Dialect;
+using NHibernate.Type;
+using NUnit.Framework;
+using SharpTestsEx;
+using System;
+
+namespace NHibernate.Test.TypesTest
+{
+ public class DateTypeTest
+ {
+ [Test]
+ public void WhenNoParameterThenDefaultValueIsBaseDateValue()
+ {
+ var dateType = new DateType();
+ dateType.DefaultValue.Should().Be(DateType.BaseDateValue);
+ }
+
+ [Test]
+ public void WhenSetParameterThenDefaultValueIsParameterValue()
+ {
+ var dateType = new DateType();
+ dateType.SetParameterValues(new Dictionary<string, string>{{DateType.BaseValueParameterName, "0001/01/01"}});
+ dateType.DefaultValue.Should().Be(DateTime.MinValue);
+ }
+
+ [Test]
+ public void WhenSetParameterNullThenNotThrow()
+ {
+ var dateType = new DateType();
+ dateType.Executing(dt=> dt.SetParameterValues(null)).NotThrows();
+ }
+ }
+
+ public class DateTypeFixture : TypeFixtureBase
+ {
+ protected override string TypeName
+ {
+ get { return "Date"; }
+ }
+
+ [Test]
+ public void ShouldBeDateType()
+ {
+ if (!(Dialect is MsSql2008Dialect))
+ {
+ Assert.Ignore("This test does not apply to " + Dialect);
+ }
+ var sqlType = Dialect.GetTypeName(NHibernateUtil.Date.SqlType);
+ sqlType.ToLowerInvariant().Should().Be("date");
+ }
+
+ [Test]
+ public void ReadWriteNormal()
+ {
+ var expected = DateTime.Today.Date;
+
+ var basic = new DateClass { DateValue = expected.AddHours(1) };
+ object savedId;
+ using (ISession s = OpenSession())
+ {
+ savedId = s.Save(basic);
+ s.Flush();
+ }
+ using (ISession s = OpenSession())
+ {
+ basic = s.Get<DateClass>(savedId);
+ basic.DateValue.Should().Be(expected);
+ s.Delete(basic);
+ s.Flush();
+ }
+ }
+
+ [Test]
+ public void ReadWriteBaseValue()
+ {
+ var basic = new DateClass { DateValue = new DateTime(1899,1,1) };
+ object savedId;
+ using (ISession s = OpenSession())
+ {
+ savedId = s.Save(basic);
+ s.Flush();
+ }
+ using (ISession s = OpenSession())
+ {
+ basic = s.Get<DateClass>(savedId);
+ basic.DateValue.HasValue.Should().Be.False();
+ s.Delete(basic);
+ s.Flush();
+ }
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-21 20:58:58
|
Revision: 5035
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5035&view=rev
Author: fabiomaulo
Date: 2010-07-21 20:58:52 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Apply patch of NH-2106 (thanks to Julien Letrouit)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs
Modified: trunk/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs 2010-07-21 20:47:45 UTC (rev 5034)
+++ trunk/nhibernate/src/NHibernate/Criterion/DetachedCriteria.cs 2010-07-21 20:58:52 UTC (rev 5035)
@@ -170,6 +170,18 @@
return this;
}
+ public DetachedCriteria SetLockMode(LockMode lockMode)
+ {
+ criteria.SetLockMode(lockMode);
+ return this;
+ }
+
+ public DetachedCriteria SetLockMode(string alias, LockMode lockMode)
+ {
+ criteria.SetLockMode(alias, lockMode);
+ return this;
+ }
+
public DetachedCriteria SetCacheMode(CacheMode cacheMode)
{
criteria.SetCacheMode(cacheMode);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-21 20:47:52
|
Revision: 5034
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5034&view=rev
Author: fabiomaulo
Date: 2010-07-21 20:47:45 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Fix NH-2122
Modified Paths:
--------------
trunk/nhibernate/doc/reference/modules/query_criteria.xml
Modified: trunk/nhibernate/doc/reference/modules/query_criteria.xml
===================================================================
--- trunk/nhibernate/doc/reference/modules/query_criteria.xml 2010-07-21 20:31:40 UTC (rev 5033)
+++ trunk/nhibernate/doc/reference/modules/query_criteria.xml 2010-07-21 20:47:45 UTC (rev 5034)
@@ -131,13 +131,13 @@
Note that the kittens collections held by the <literal>Cat</literal> instances
returned by the previous two queries are <emphasis>not</emphasis> pre-filtered
by the criteria! If you wish to retrieve just the kittens that match the
- criteria, you must use <literal>SetResultTransformer(CriteriaUtil.AliasToEntityMap)</literal>.
+ criteria, you must use <literal>SetResultTransformer(Transformers.AliasToEntityMap)</literal>.
</para>
<programlisting><![CDATA[IList cats = sess.CreateCriteria(typeof(Cat))
.CreateCriteria("Kittens", "kt")
.Add( Expression.Eq("Name", "F%") )
- .SetResultTransformer(CriteriaUtil.AliasToEntityMap)
+ .SetResultTransformer(Transformers.AliasToEntityMap)
.List();
foreach ( IDictionary map in cats )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-21 20:31:47
|
Revision: 5033
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5033&view=rev
Author: fabiomaulo
Date: 2010-07-21 20:31:40 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Demonstration of ExternalIssue for NH-2207
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/DomainClass.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/Mappings.hbm.xml
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/SampleTest.cs
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/DomainClass.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/DomainClass.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/DomainClass.cs 2010-07-21 20:31:40 UTC (rev 5033)
@@ -0,0 +1,10 @@
+using System;
+
+namespace NHibernate.Test.NHSpecificTest.NH2207
+{
+ public class DomainClass
+ {
+ public virtual int Id { get; set; }
+ public virtual DateTime Date { get; set; }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/Mappings.hbm.xml 2010-07-21 20:31:40 UTC (rev 5033)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8" ?>
+ <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH2207">
+ <class name="DomainClass">
+ <id name="Id">
+ <generator class="identity" />
+ </id>
+ <property name="Date" type="Date" not-null="true" />
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/SampleTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/SampleTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH2207/SampleTest.cs 2010-07-21 20:31:40 UTC (rev 5033)
@@ -0,0 +1,89 @@
+using System;
+using System.Data;
+using NHibernate.Dialect;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.NHSpecificTest.NH2207
+{
+ [TestFixture, Ignore("Demostration of external issue")]
+ public class SampleTest : BugTestCase
+ {
+ protected override bool AppliesTo(Dialect.Dialect dialect)
+ {
+ return dialect as MsSql2008Dialect != null;
+ }
+
+ [Test]
+ public void WithoutUseNHSqlDataProviderWorkProperly()
+ {
+ var createTable = "CREATE TABLE TryDate([Id] [int] IDENTITY(1,1) NOT NULL,[MyDate] [date] NOT NULL)";
+ var dropTable = "DROP TABLE TryDate";
+ var insertTable = "INSERT INTO TryDate([MyDate]) VALUES(@p0)";
+ using(var sqlConnection = new System.Data.SqlClient.SqlConnection(cfg.Properties[Cfg.Environment.ConnectionString]))
+ {
+ sqlConnection.Open();
+ using (var tx = sqlConnection.BeginTransaction())
+ {
+ var command = sqlConnection.CreateCommand();
+ command.Transaction = tx;
+ command.CommandText = createTable;
+ command.ExecuteNonQuery();
+ tx.Commit();
+ }
+
+ try
+ {
+ using (var tx = sqlConnection.BeginTransaction())
+ {
+ var command = sqlConnection.CreateCommand();
+ command.Transaction = tx;
+ command.CommandText = insertTable;
+ var dateParam = command.CreateParameter();
+ dateParam.ParameterName = "@p0";
+ dateParam.DbType = DbType.Date;
+ dateParam.Value = DateTime.MinValue.Date;
+ command.Parameters.Add(dateParam);
+ command.ExecuteNonQuery();
+ tx.Commit();
+ }
+ }
+ finally
+ {
+ using (var tx = sqlConnection.BeginTransaction())
+ {
+ var command = sqlConnection.CreateCommand();
+ command.Transaction = tx;
+ command.CommandText = dropTable;
+ command.ExecuteNonQuery();
+ tx.Commit();
+ }
+ }
+ }
+
+ }
+
+ [Test]
+ public void Dates_Before_1753_Should_Not_Insert_Null()
+ {
+ object savedId;
+ var expectedStoredValue = DateTime.MinValue.Date.AddDays(1).Date;
+ using (ISession session = OpenSession())
+ using (var tx = session.BeginTransaction())
+ {
+ var concrete = new DomainClass{Date = expectedStoredValue.AddMinutes(90)};
+ savedId = session.Save(concrete);
+ tx.Commit();
+ }
+
+ using (ISession session = OpenSession())
+ using (var tx = session.BeginTransaction())
+ {
+ var savedObj = session.Get<DomainClass>(savedId);
+ savedObj.Date.Should().Be(expectedStoredValue);
+ session.Delete(savedObj);
+ tx.Commit();
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 17:51:11 UTC (rev 5032)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 20:31:40 UTC (rev 5033)
@@ -752,6 +752,8 @@
<Compile Include="NHSpecificTest\NH2195\SQLiteMultiCriteriaTest.cs" />
<Compile Include="NHSpecificTest\NH2201\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2201\Model.cs" />
+ <Compile Include="NHSpecificTest\NH2207\DomainClass.cs" />
+ <Compile Include="NHSpecificTest\NH2207\SampleTest.cs" />
<Compile Include="NHSpecificTest\NH2230\Domain.cs" />
<Compile Include="NHSpecificTest\NH2230\Fixture.cs" />
<Compile Include="NHSpecificTest\NH2234\Fixture.cs" />
@@ -2198,6 +2200,7 @@
<EmbeddedResource Include="DriverTest\SqlServerCeEntity.hbm.xml" />
<EmbeddedResource Include="CollectionTest\NullableValueTypeElementMapFixture.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH2207\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2243\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1891\FormulaEscaping.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH2242\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fab...@us...> - 2010-07-21 17:51:21
|
Revision: 5032
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5032&view=rev
Author: fabiomaulo
Date: 2010-07-21 17:51:11 +0000 (Wed, 21 Jul 2010)
Log Message:
-----------
Fix NH-2227 (fixed also for others IPropertyAccessor, ISetter, IGetter)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs
trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs
Modified: trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/BackrefPropertyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -6,6 +6,7 @@
namespace NHibernate.Properties
{
/// <summary> Represents a "back-reference" to the id of a collection owner. </summary>
+ [Serializable]
public class BackrefPropertyAccessor : IPropertyAccessor
{
public static readonly object Unknown = new object();
Modified: trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/EmbeddedPropertyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -5,6 +5,7 @@
namespace NHibernate.Properties
{
+ [Serializable]
public class EmbeddedPropertyAccessor : IPropertyAccessor
{
#region IPropertyAccessor Members
Modified: trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/IndexPropertyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -6,6 +6,7 @@
namespace NHibernate.Properties
{
/// <summary> Represents a "back-reference" to the index of a collection. </summary>
+ [Serializable]
public class IndexPropertyAccessor : IPropertyAccessor
{
private readonly string propertyName;
@@ -40,6 +41,7 @@
#endregion
/// <summary> The Setter implementation for index backrefs.</summary>
+ [Serializable]
public sealed class IndexSetter : ISetter
{
#region ISetter Members
@@ -62,6 +64,7 @@
}
/// <summary> The Getter implementation for index backrefs.</summary>
+ [Serializable]
public class IndexGetter : IGetter
{
private readonly IndexPropertyAccessor encloser;
Modified: trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/MapAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -4,6 +4,7 @@
using System;
namespace NHibernate.Properties
{
+ [Serializable]
public class MapAccessor : IPropertyAccessor
{
#region IPropertyAccessor Members
Modified: trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/NoSetterAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -1,3 +1,5 @@
+using System;
+
namespace NHibernate.Properties
{
/// <summary>
@@ -9,6 +11,7 @@
/// that is the <c><id></c> but tell NHibernate there is no setter for the Property
/// so the value should be written directly to the field.
/// </remarks>
+ [Serializable]
public class NoSetterAccessor : IPropertyAccessor
{
private readonly IFieldNamingStrategy namingStrategy;
Modified: trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/NoopAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -1,3 +1,4 @@
+using System;
using System.Collections;
using System.Reflection;
using NHibernate.Engine;
@@ -5,6 +6,7 @@
namespace NHibernate.Properties
{
/// <summary> Used to declare properties not represented at the pojo level </summary>
+ [Serializable]
public class NoopAccessor : IPropertyAccessor
{
#region IPropertyAccessor Members
@@ -27,6 +29,7 @@
#endregion
/// <summary> A Getter which will always return null. It should not be called anyway.</summary>
+ [Serializable]
private class NoopGetter : IGetter
{
#region IGetter Members
@@ -60,6 +63,7 @@
}
/// <summary> A Setter which will just do nothing.</summary>
+ [Serializable]
private class NoopSetter : ISetter
{
#region ISetter Members
Modified: trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/ReadonlyAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -1,3 +1,4 @@
+using System;
using System.Reflection;
namespace NHibernate.Properties
@@ -10,6 +11,7 @@
/// This is useful to allow calculated properties in the domain that will never
/// be recovered from the DB but can be used for querying.
/// </remarks>
+ [Serializable]
public class ReadOnlyAccessor : IPropertyAccessor
{
/// <summary>
@@ -64,6 +66,7 @@
#endregion
+ [Serializable]
private class NoopSetter : ISetter
{
public void Set(object target, object value) {}
Modified: trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate/Properties/XmlAccessor.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -11,6 +11,7 @@
/// Responsible for accessing property values represented as a XmlElement
/// or XmlAttribute.
/// </summary>
+ [Serializable]
public class XmlAccessor : IPropertyAccessor
{
private readonly ISessionFactoryImplementor factory;
Added: trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/CfgTest/AccessorsSerializableTest.cs 2010-07-21 17:51:11 UTC (rev 5032)
@@ -0,0 +1,35 @@
+using System;
+using System.Linq;
+using NHibernate.Properties;
+using NUnit.Framework;
+using SharpTestsEx;
+
+namespace NHibernate.Test.CfgTest
+{
+ public class AccessorsSerializableTest
+ {
+ private static System.Type[] accessors = typeof (IPropertyAccessor).Assembly.GetTypes().Where(t => t.Namespace == typeof (IPropertyAccessor).Namespace && t.GetInterfaces().Contains(typeof (IPropertyAccessor))).ToArray();
+
+ [Test, TestCaseSource("accessors")]
+ public void AllAccessorsAreMarkedAsSerializable(System.Type concreteAccessor)
+ {
+ concreteAccessor.Should().Have.Attribute<SerializableAttribute>();
+ }
+
+ private static System.Type[] setters = typeof(ISetter).Assembly.GetTypes().Where(t => t.Namespace == typeof(ISetter).Namespace && t.GetInterfaces().Contains(typeof(ISetter))).ToArray();
+
+ [Test, TestCaseSource("setters")]
+ public void AllSettersAreMarkedAsSerializable(System.Type concreteAccessor)
+ {
+ concreteAccessor.Should().Have.Attribute<SerializableAttribute>();
+ }
+
+ private static System.Type[] getters = typeof(IGetter).Assembly.GetTypes().Where(t => t.Namespace == typeof(IGetter).Namespace && t.GetInterfaces().Contains(typeof(IGetter))).ToArray();
+
+ [Test, TestCaseSource("getters")]
+ public void AllGettersAreMarkedAsSerializable(System.Type concreteAccessor)
+ {
+ concreteAccessor.Should().Have.Attribute<SerializableAttribute>();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 17:19:49 UTC (rev 5031)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2010-07-21 17:51:11 UTC (rev 5032)
@@ -108,6 +108,7 @@
<Compile Include="Cascade\Job.cs" />
<Compile Include="Cascade\JobBatch.cs" />
<Compile Include="Cascade\RefreshFixture.cs" />
+ <Compile Include="CfgTest\AccessorsSerializableTest.cs" />
<Compile Include="CfgTest\ConfigurationFixture.cs" />
<Compile Include="CfgTest\ConfigurationSchemaFixture.cs" />
<Compile Include="CfgTest\ConfigurationSerializationTests.cs" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|