Skip to content

Commit 2adba0b

Browse files
NH-4015 - Update Npgsql and enable DTC for it.
1 parent a264f23 commit 2adba0b

File tree

11 files changed

+4606
-3620
lines changed

11 files changed

+4606
-3620
lines changed
-294 KB
Binary file not shown.

lib/teamcity/postgresql/Npgsql.dll

261 KB
Binary file not shown.

lib/teamcity/postgresql/Npgsql.xml

+4,589-3,602
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/teamcity/postgresql/postgresql_installation.txt

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Installation steps for PostgreSQL for NH TeamCity:
66
3. Leave the port number at the default (5432), and leave the default locale;
77
4. The setup should install PostgreSQL on the machine;
88
5. Untick the option to install stack-builder at the end (it's not required).
9+
6. Find the postgresql.conf file. It lies in the directory for the databases files.
10+
7. Edit its max_prepared_transactions parameter to a positive integer. 100 by example. (This enables distributed transactions.)
11+
8. Restart PostgreSQL server.
912

1013
Creating the NH user:
1114

src/NHibernate.Config.Templates/PostgreSQL.cfg.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for your own use before compile tests in VisualStudio.
88
<session-factory name="NHibernate.Test">
99
<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>
1010
<property name="connection.connection_string">
11-
Server=localhost;Database=nhibernate;User ID=nhibernate;Password=nhibernate;
11+
Server=localhost;Database=nhibernate;User ID=nhibernate;Password=nhibernate;Enlist=true;
1212
</property>
1313
<property name="dialect">NHibernate.Dialect.PostgreSQL83Dialect</property>
1414
</session-factory>

src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs

+6
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ public void CanDeleteItemInDtc()
276276
}
277277
}
278278

279+
// Dodging "latency" due to db still haven't actually committed a distributed tx after scope disposal.
280+
Thread.Sleep(100);
281+
279282
using (var tx = new TransactionScope())
280283
{
281284
using (ISession s = OpenSession())
@@ -287,6 +290,9 @@ public void CanDeleteItemInDtc()
287290
tx.Complete();
288291
}
289292
}
293+
294+
// Dodging "latency" due to db still haven't actually committed a distributed tx after scope disposal.
295+
Thread.Sleep(100);
290296
}
291297

292298
[Test]

src/NHibernate.Test/NHibernate.Test.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
<HintPath>..\packages\System.Linq.Dynamic.1.0.7\lib\net40\System.Linq.Dynamic.dll</HintPath>
9696
<Private>True</Private>
9797
</Reference>
98+
<Reference Include="System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
99+
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
100+
</Reference>
98101
<Reference Include="System.Transactions" />
99102
<Reference Include="System.Xml" />
100103
<Reference Include="System.Xml.Linq">
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
6-
namespace NHibernate.Test.TestDialects
1+
namespace NHibernate.Test.TestDialects
72
{
83
public class PostgreSQL83TestDialect : TestDialect
94
{
@@ -21,13 +16,5 @@ public override bool SupportsNullCharactersInUtfStrings
2116
{
2217
get { return false; }
2318
}
24-
25-
/// <summary>
26-
/// Npgsql's DTC code seems to be somewhat broken as of 2.0.11.
27-
/// </summary>
28-
public override bool SupportsDistributedTransactions
29-
{
30-
get { return false; }
31-
}
3219
}
3320
}

src/NHibernate.Test/packages.config

+2
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
<package id="NUnit" version="3.6.0" targetFramework="net461" />
77
<package id="Remotion.Linq" version="1.15.15.0" targetFramework="net461" />
88
<package id="System.Linq.Dynamic" version="1.0.7" targetFramework="net461" />
9+
<!-- System.Threading.Tasks.Extensions is required for dynamically loaded Npgsql.dll (Postgresql driver) -->
10+
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net461" />
911
</packages>

src/NHibernate/Driver/NpgsqlDriver.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using System;
21
using System.Data;
32
using System.Data.Common;
4-
using System.Linq;
53

64
namespace NHibernate.Driver
75
{

teamcity.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
<target name="setup-teamcity-postgresql">
141141
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.NpgsqlDriver" />
142142
<property name="nhibernate.dialect" value="NHibernate.Dialect.PostgreSQL83Dialect" />
143-
<property name="nhibernate.connection.connection_string" value="Host=localhost;Port=5432;Database=nhibernate;Username=nhibernate;Password=nhibernate" />
143+
<property name="nhibernate.connection.connection_string" value="Host=localhost;Port=5432;Database=nhibernate;Username=nhibernate;Password=nhibernate;Enlist=true" />
144144
<copy todir="${bin.dir}">
145145
<fileset basedir="${root.dir}/lib/teamcity/postgresql">
146146
<include name="*.dll"/>

0 commit comments

Comments
 (0)