Skip to content

Commit a70af4e

Browse files
committed
Merge branch '3.3.x'
2 parents 7e32107 + 5979442 commit a70af4e

38 files changed

+945
-68
lines changed

ReleaseProcedure.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ These are the tasks typically needed to create an official NHibernate release.
1515
* Perform the release build including running all tests (GaRelease.bat or
1616
ShowBuildMenu.bat).
1717

18+
NOTE: If you prefer to keep your source code in a path like e.g.:
19+
C:\Users\Something\Long\Projects\nhibernate-core
20+
you may want to issue a command like:
21+
subst P: C:\Users\Something\Long\Projects
22+
And then change to P:\nhibernate-core before building. This will avoid
23+
displaying a long user-specific path in public symbol files.
24+
1825
* If no error or other issue requiring further changes occured, tag the
1926
current git HEAD with a tag according to version number. Don't forget to
2027
push the tag to github.

Tools/NuGet.exe

1 KB
Binary file not shown.

doc/reference/modules/performance.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ int accessLevel = (int) permissions["accounts"]; // Error!]]></programlisting>
276276
of persistent collections. However, a different mechanism is needed for lazy
277277
behavior in single-ended associations. The target entity of the association must
278278
be proxied. NHibernate implements lazy initializing proxies for persistent objects
279-
using runtime bytecode enhancement (via the excellent Castle.DynamicProxy library).
279+
using runtime bytecode enhancement.
280280
</para>
281281

282282
<para>

doc/reference/modules/quickstart.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
No special interface has to be implemented for persistent classes nor do we have
166166
to subclass from a special root persistent class. NHibernate also doesn't use any
167167
build time processing, such as IL manipulation, it relies solely on
168-
.NET reflection and runtime class enhancement (through Castle.DynamicProxy library).
168+
.NET reflection and runtime class enhancement.
169169
So, without any dependency in the POCO class on NHibernate, we can map it to
170170
a database table.
171171
</para>

releasenotes.txt

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Build vNext
22
=============================
33

4-
** Known BREAKING CHANGES from NH3.3.2.GA to vNext
4+
** Known BREAKING CHANGES from NH3.3.3.CR1 to vNext
55

66
NHibernate now targets .Net 4.0. Many uses of set types from Iesi.Collections have
77
now been changed to use corresponding types from the BCL. The API for these types
@@ -26,6 +26,62 @@ Build vNext
2626
* Oracle: The atan2 and power functions now return double (instead of single) for consistency with other dialects.
2727
* Removed FirebirdDriver. It was the same as FirebirdClientDriver since 3.2, and the latter have been the default since then.
2828

29+
Build 3.3.3.CR1
30+
=============================
31+
32+
** Fix
33+
* [NH-3148] - ComponentAsId properties do not maintain the Column specified using property mapper when component is from base class
34+
35+
** Sub-task
36+
* [NH-3052] - Projection of one-to-many generates invalid SQL
37+
* [NH-3385] - Add ability to expand many subcollections with WCF Data Services
38+
39+
** Bug
40+
* [NH-2042] - Table per subclass, using a discriminator mappings with formula in child class error
41+
* [NH-2539] - Contains/StartsWith fails when invoked via WCF Data Service.
42+
* [NH-2566] - NotSupportedException when using Skip/Take/First/Single/Any on GroupBy
43+
* [NH-2588] - NotSupportedException when using Skip/Take with Where clause
44+
* [NH-2860] - Lazy property throwing casting exception
45+
* [NH-2979] - MsSqlCe dialect doesn't give the correct SQL type for Decimal with Scale defined
46+
* [NH-3039] - IndexOutOfRangeException thrown when web server is processing multiple sessionfactory creation requests
47+
* [NH-3057] - Collection subquery constraint on joined-subclass inherited properties causes invalid sql (base classes are not joined in).
48+
* [NH-3105] - ComponentAsId does not find property that belongs to a parent class
49+
* [NH-3108] - OrderBy with Select throws exception
50+
* [NH-3129] - Linq Provider doesn't recognize CompareTo method
51+
* [NH-3241] - Linq: Mixing Fetch/FetchMany with Any() throws: ArgumentException: Expression of type 'System.Collections.IList' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable`1[System.Object]'
52+
* [NH-3261] - Linq Query throws when there is a conditional operator
53+
* [NH-3305] - SybaseSQLAnywhere10Dialect defaults a numeric datatype to (19,255) precision, which is not compatible with the DB
54+
* [NH-3318] - Composite-id does not allow superclass properties
55+
* [NH-3320] - Exception in LINQ projection with OrderBy/Take - block using WCF Data Services projection's
56+
* [NH-3326] - Exception in LINQ with pagination - block using WCF Data Services
57+
* [NH-3330] - Exception in LINQ for nullable strings in Oracle - blocks using WCF Data Services
58+
* [NH-3332] - The NH linq driver generates sql code that doesn't match the semantics of the original linq query
59+
* [NH-3337] - Exception in LINQ for complex nullable conditionals - blocks using WCF Data Services
60+
* [NH-3357] - System.NotSupportedException : Don't currently support idents of type DateTimeOffset
61+
* [NH-3366] - LINQ query with various Compare() and CompareTo() fails (WCF Data Services)
62+
* [NH-3369] - ToFuture/ToFutureValue should fall-back on dialects without MultiQuery support
63+
* [NH-3378] - MySQLDialect incorrect handle DbType.Currency as MONEY
64+
* [NH-3379] - Oracle8iDialect and FirebirdDialect incorrect handle DbType.Currency type
65+
66+
** Improvement
67+
* [NH-2297] - Configuration.BuildSessionFactory throws a NullReferenceException when loading an invalid ICompositeUserType
68+
* [NH-3301] - Support SqlMethods.Like() in LINQ queries.
69+
* [NH-3360] - Allow setting timeout on a LINQ query
70+
* [NH-3367] - Support string.Equals()
71+
* [NH-3368] - Add support for Equals method of sbyte, DateTimeOffset and unsigned numerics
72+
* [NH-3371] - NHibernate should log LINQ expression trees to ease debugging
73+
74+
** New Feature
75+
* [NH-2986] - Add ability to include collections into projections
76+
* [NH-3092] - Nhibernate Linq provider does not support Math functions like Math.Cos, Math.Sin, etc
77+
* [NH-3180] - Could not select first element of the group
78+
* [NH-3184] - Add ability to use ToFutureValue with aggregating queries
79+
* [NH-3283] - New driver: Devart.Data.MySql
80+
* [NH-3333] - Add ability to expand subcollections with WCF Data Services
81+
82+
** Patch
83+
* [NH-3255] - The IDbCommand that performs the cleanup of data in AbstractStatementExecutor.DropTemporaryTableIfNecessary does not have a connection.
84+
2985
Build 3.3.2.GA
3086
=============================
3187

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
using System.Collections.Generic;
2+
using NHibernate.Dialect;
3+
using NHibernate.SqlCommand;
4+
using NUnit.Framework;
5+
6+
namespace NHibernate.Test.DialectTest
7+
{
8+
[TestFixture]
9+
public class LockHintAppenderFixture
10+
{
11+
private const string MsSql2000LockHint = " with (updlock, rowlock)";
12+
private MsSql2000Dialect.LockHintAppender _appender;
13+
14+
[SetUp]
15+
public void SetUp()
16+
{
17+
_appender = new MsSql2000Dialect.LockHintAppender(new MsSql2000Dialect(), new Dictionary<string, LockMode> { {"person", LockMode.Upgrade} });
18+
}
19+
20+
[Test]
21+
public void AppendHintToSingleTableAlias()
22+
{
23+
const string expectedQuery1 = "select * from Person person with (updlock, rowlock)";
24+
const string expectedQuery2 = "select * from Person as person with (updlock, rowlock)";
25+
26+
var result1 = _appender.AppendLockHint(new SqlString(expectedQuery1.Replace(MsSql2000LockHint, string.Empty)));
27+
Assert.That(result1.ToString(), Is.EqualTo(expectedQuery1));
28+
29+
var result2 = _appender.AppendLockHint(new SqlString(expectedQuery2.Replace(MsSql2000LockHint, string.Empty)));
30+
Assert.That(result2.ToString(), Is.EqualTo(expectedQuery2));
31+
}
32+
33+
[Test]
34+
public void AppendHintToJoinedTableAlias()
35+
{
36+
const string expectedQuery =
37+
"select * from Person person with (updlock, rowlock) inner join Country country on person.Id = country.Id";
38+
39+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
40+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
41+
}
42+
43+
[Test]
44+
public void AppendHintToUnionTableAlias()
45+
{
46+
const string expectedQuery =
47+
"select Id, Name from (select Id, CONCAT(FirstName, LastName) from Employee with (updlock, rowlock) union all select Id, CONCAT(FirstName, LastName) from Manager with (updlock, rowlock)) as person";
48+
49+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
50+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
51+
}
52+
53+
[Test]
54+
public void ShouldIgnoreCasing()
55+
{
56+
const string expectedQuery =
57+
"select Id, Name FROM (select Id, Name FROM Employee with (updlock, rowlock) union all select Id, Name from Manager with (updlock, rowlock)) as person";
58+
59+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
60+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
61+
}
62+
63+
[Test]
64+
public void ShouldHandleExplicitSchemas()
65+
{
66+
const string expectedQuery =
67+
"select Id, Name from (select Id, Name FROM dbo.Employee with (updlock, rowlock) union all select Id, Name from Manager with (updlock, rowlock)) as person";
68+
69+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
70+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
71+
}
72+
73+
[Test]
74+
public void ShouldHandleExplicitSchemasAndDbNames()
75+
{
76+
const string expectedQuery =
77+
"select Id, Name from (select Id, Name FROM nhibernate.dbo.Employee with (updlock, rowlock) union all select Id, Name from Manager with (updlock, rowlock)) as person";
78+
79+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
80+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
81+
}
82+
83+
[Test]
84+
public void ShouldHandleExplicitDbNameWithoutSchemaName()
85+
{
86+
const string expectedQuery =
87+
"select Id, Name from (select Id, Name FROM nhibernate..Employee with (updlock, rowlock) union all select Id, Name from Manager with (updlock, rowlock)) as person";
88+
89+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
90+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
91+
}
92+
93+
[Test]
94+
public void ShouldHandleExplicitSchemasAndDbNamesWithSpacesBetweenNameParts()
95+
{
96+
const string expectedQuery =
97+
"select Id, Name from (select Id, Name FROM nhibernate .dbo. Employee with (updlock, rowlock) union all select Id, Name from Manager with (updlock, rowlock)) as person";
98+
99+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
100+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
101+
}
102+
103+
[Test]
104+
public void ShouldHandleEscapingInSubselect()
105+
{
106+
const string expectedQuery =
107+
"select Id, Name from (select Id, Name from [Employee] with (updlock, rowlock) union all select Id, Name from [Manager] with (updlock, rowlock)) as person";
108+
109+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
110+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
111+
}
112+
113+
[Test]
114+
public void ShouldHandleEscapingWithWhitespacesInSubselect()
115+
{
116+
const string expectedQuery =
117+
"select Id, Name from (select Id, Name from [Empl oyee] with (updlock, rowlock) union all select Id, Name from [Man ager] with (updlock, rowlock)) as person";
118+
119+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
120+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
121+
}
122+
123+
[Test]
124+
public void ShouldHandleEscapingWithSquareBracketsInSubselect()
125+
{
126+
const string expectedQuery =
127+
"select Id, Name from (select Id, Name from [Empl ]]oyee] with (updlock, rowlock) union all select Id, Name from [Manager] with (updlock, rowlock)) as person";
128+
129+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
130+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
131+
}
132+
133+
[Test]
134+
public void ShouldHandleMultilineQuery()
135+
{
136+
const string expectedQuery = @"
137+
select Id, Name from
138+
(select Id, Name from Employee with (updlock, rowlock) union all
139+
select Id, Name from Manager with (updlock, rowlock))
140+
as person";
141+
142+
var result = _appender.AppendLockHint(new SqlString(expectedQuery.Replace(MsSql2000LockHint, string.Empty)));
143+
Assert.That(result.ToString(), Is.EqualTo(expectedQuery));
144+
}
145+
}
146+
}

src/NHibernate.Test/Linq/ProjectionsTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,20 @@ private string FormatName(string name, DateTime? lastLoginDate)
438438
return string.Format("User {0} logged in at {1}", name, lastLoginDate);
439439
}
440440

441+
442+
/// <summary>
443+
/// This mimic classes in System.Data.Services.Internal.
444+
/// </summary>
441445
class ExpandedWrapper<TExpandedElement>
442446
{
443447
public TExpandedElement ExpandedElement { get; set; }
444448
public string Description { get; set; }
445449
public string ReferenceDescription { get; set; }
446450
}
447451

452+
/// <summary>
453+
/// This mimic classes in System.Data.Services.Internal.
454+
/// </summary>
448455
class ExpandedWrapper<TExpandedElement, TProperty0> : ExpandedWrapper<TExpandedElement>
449456
{
450457
public TProperty0 ProjectedProperty0 { get; set; }

src/NHibernate.Test/Linq/WhereTests.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
4+
using System.Collections.ObjectModel;
35
using System.Linq;
46
using System.Linq.Expressions;
7+
using NHibernate.Engine.Query;
58
using NHibernate.Linq;
69
using NHibernate.DomainModel.Northwind.Entities;
710
using NUnit.Framework;
@@ -440,6 +443,34 @@ where names.Contains(user.Name)
440443
Assert.That(query.Count, Is.EqualTo(2));
441444
}
442445

446+
[Test, Description("NH-3413")]
447+
public void UsersWithListContains_MutatingListDoesNotBreakOtherSessions()
448+
{
449+
{
450+
var names = new List<string> { "ayende", "rahien" };
451+
452+
var query = (from user in db.Users
453+
where names.Contains(user.Name)
454+
select user).ToList();
455+
456+
Assert.AreEqual(2, query.Count);
457+
458+
names.Clear();
459+
}
460+
461+
{
462+
var names = new List<string> { "ayende" };
463+
464+
var query = (from user in db.Users
465+
where names.Contains(user.Name)
466+
select user).ToList();
467+
468+
// This line fails with Expected: 1 But was: 0
469+
// The SQL in NHProf shows that the where clause was executed as WHERE 1 = 0 as if names were empty
470+
Assert.AreEqual(1, query.Count);
471+
}
472+
}
473+
443474
[Test]
444475
public void UsersWithEmptyList_NH2400()
445476
{

src/NHibernate.Test/MappingByCode/IntegrationTests/NH3105/Fixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace NHibernate.Test.MappingByCode.IntegrationTests.NH3105
99
public class Fixture
1010
{
1111
[Test]
12-
public void CanMapComponentAsIdWhenComnponentIsDeclaredInBaseClass()
12+
public void CanMapComponentAsIdWhenComponentIsDeclaredInBaseClass()
1313
{
1414
var mapper = new ModelMapper();
1515
mapper.Class<Entity>(rc =>
@@ -48,7 +48,7 @@ public void CanMapIdWhenIdIsDeclaredInBaseClass()
4848
}
4949

5050
[Test]
51-
public void CanMapComponentAsIdWhenComnponentIsDeclaredInClass()
51+
public void CanMapComponentAsIdWhenComponentIsDeclaredInClass()
5252
{
5353
var mapper = new ModelMapper();
5454
mapper.Class<EntityBase>(rc =>

src/NHibernate.Test/MappingTest/ForeignKeyFixture.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,25 @@ public void UnmatchingColumns()
3939
fk.ReferencedTable = primaryTable;
4040
Assert.Throws<FKUnmatchingColumnsException>(() => fk.AlignColumns());
4141
}
42+
43+
[Test]
44+
public void ToStringDoesNotThrow()
45+
{
46+
var key = new ForeignKey
47+
{
48+
Table = new Table("TestTable"),
49+
Name = "TestForeignKey"
50+
};
51+
key.AddColumn(new Column("TestColumn"));
52+
key.AddReferencedColumns(new[] { new Column("ReferencedColumn") });
53+
54+
string toString = null;
55+
Assert.DoesNotThrow(() =>
56+
{
57+
toString = key.ToString();
58+
});
59+
60+
Assert.That(toString, Is.EqualTo("NHibernate.Mapping.ForeignKey(TestTableNHibernate.Mapping.Column(TestColumn) ref-columns:(NHibernate.Mapping.Column(ReferencedColumn)) as TestForeignKey"));
61+
}
4262
}
4363
}

0 commit comments

Comments
 (0)