Skip to content

Commit 5b8148d

Browse files
committed
NH-3807 - Distributed transactions not supported in .netcore
1 parent 4084915 commit 5b8148d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
1919
<Compile Remove="DriverTest\**" />
20+
<Compile Remove="NHSpecificTest\NH1054\**" />
2021
<Compile Remove="NHSpecificTest\NH2188\**" />
2122
<Compile Remove="NHSpecificTest\NH2484\**" />
2223
<Compile Remove="NHSpecificTest\NH2985\**" />

src/NHibernate/Cfg/SettingsFactory.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,16 @@ private static System.Type CreateLinqQueryProviderType(IDictionary<string, strin
392392

393393
private static ITransactionFactory CreateTransactionFactory(IDictionary<string, string> properties)
394394
{
395+
System.Type transactionFactory;
396+
397+
#if NETSTANDARD2_0
398+
transactionFactory = typeof(AdoNetTransactionFactory);
399+
#else
400+
transactionFactory = typeof(AdoNetWithDistributedTransactionFactory);
401+
#endif
402+
395403
string className = PropertiesHelper.GetString(
396-
Environment.TransactionStrategy, properties, typeof(AdoNetWithDistributedTransactionFactory).FullName);
404+
Environment.TransactionStrategy, properties, transactionFactory.FullName);
397405
log.Info("Transaction factory: " + className);
398406

399407
try

src/NHibernate/Transaction/AdoNetWithDistributedTransactionFactory.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if !NETSTANDARD2_0
12
using System;
23
using System.Collections;
34
using System.Transactions;
@@ -181,4 +182,5 @@ public void Dispose()
181182
}
182183
}
183184
}
184-
}
185+
}
186+
#endif

0 commit comments

Comments
 (0)