3737using JetBrains . Annotations ;
3838using Npgsql . Logging ;
3939using Npgsql . NameTranslation ;
40- #if NET45 || NET451
41- using System . Transactions ;
42- #endif
4340using NpgsqlTypes ;
4441using IsolationLevel = System . Data . IsolationLevel ;
4542using ThreadState = System . Threading . ThreadState ;
4643
44+ #if ! NETSTANDARD1_3
45+ using System . Transactions ;
46+ #endif
47+
4748namespace Npgsql
4849{
4950 /// <summary>
@@ -90,7 +91,7 @@ public sealed class NpgsqlConnection : DbConnection, ICloneable
9091
9192 bool _wasBroken ;
9293
93- #if NET45 || NET451
94+ #if ! NETSTANDARD1_3
9495 [ CanBeNull ]
9596 internal Transaction EnlistedTransaction { get ; set ; }
9697#endif
@@ -128,7 +129,7 @@ public NpgsqlConnection(string connectionString)
128129 GC . SuppressFinalize ( this ) ;
129130 ConnectionString = connectionString ;
130131
131- #if NET45 || NET451
132+ #if ! NETSTANDARD1_3
132133 // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
133134 // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
134135 RSACryptoServiceProvider . UseMachineKeyStore = true ;
@@ -221,7 +222,7 @@ async Task Open(bool async, CancellationToken cancellationToken)
221222 {
222223 _userFacingConnectionString = _pool . UserFacingConnectionString ;
223224
224- #if NET45 || NET451
225+ #if ! NETSTANDARD1_3
225226 if ( Settings . Enlist )
226227 {
227228 if ( Transaction . Current != null )
@@ -238,7 +239,7 @@ async Task Open(bool async, CancellationToken cancellationToken)
238239 }
239240 else // No enlist
240241#endif
241- Connector = await _pool . Allocate ( this , timeout , async, cancellationToken ) ;
242+ Connector = await _pool . Allocate ( this , timeout , async, cancellationToken ) ;
242243
243244 Counters . SoftConnectsPerSecond . Increment ( ) ;
244245
@@ -247,7 +248,7 @@ async Task Open(bool async, CancellationToken cancellationToken)
247248 Connector . TypeHandlerRegistry . ActivateGlobalMappings ( ) ;
248249 }
249250
250- #if NET45 || NET451
251+ #if ! NETSTANDARD1_3
251252 // We may have gotten an already enlisted pending connector above, no need to enlist in that case
252253 if ( Settings . Enlist && Transaction . Current != null && EnlistedTransaction == null )
253254 EnlistTransaction ( Transaction . Current ) ;
@@ -499,7 +500,7 @@ protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLeve
499500 }
500501 }
501502
502- #if NET45 || NET451
503+ #if ! NETSTANDARD1_3
503504 /// <summary>
504505 /// Enlist transation.
505506 /// </summary>
@@ -553,7 +554,9 @@ internal void Close(bool wasBroken)
553554 Connector . Close ( ) ;
554555 else
555556 {
556- #if NET45 || NET451
557+ #if NETSTANDARD1_3
558+ _pool . Release ( Connector ) ;
559+ #else
557560 if ( EnlistedTransaction == null )
558561 _pool . Release ( Connector ) ;
559562 else
@@ -565,8 +568,6 @@ internal void Close(bool wasBroken)
565568 Connector . Connection = null ;
566569 EnlistedTransaction = null ;
567570 }
568- #else
569- _pool . Release ( Connector ) ;
570571#endif
571572 }
572573
@@ -1253,7 +1254,7 @@ internal NpgsqlConnector CheckReadyAndGetConnector()
12531254 #endregion State checks
12541255
12551256 #region Schema operations
1256- #if NET45 || NET451
1257+ #if ! NETSTANDARD1_3
12571258 /// <summary>
12581259 /// Returns the supported collections
12591260 /// </summary>
@@ -1335,7 +1336,7 @@ public override DataTable GetSchema([CanBeNull] string collectionName, [CanBeNul
13351336 /// <summary>
13361337 /// Creates a closed connection with the connection string and authentication details of this message.
13371338 /// </summary>
1338- #if NET45 || NET451
1339+ #if ! NETSTANDARD1_3
13391340 object ICloneable . Clone ( )
13401341#else
13411342 public NpgsqlConnection Clone ( )
@@ -1393,7 +1394,7 @@ public override void ChangeDatabase(string dbName)
13931394 Open ( ) ;
13941395 }
13951396
1396- #if NET45 || NET451
1397+ #if ! NETSTANDARD1_3
13971398 /// <summary>
13981399 /// DB provider factory.
13991400 /// </summary>
0 commit comments