3535using System . Net . Security ;
3636using System . Security . Cryptography ;
3737using System . Security . Cryptography . X509Certificates ;
38+ #if ! DNXCORE50
3839using System . Transactions ;
40+ #endif
3941using Npgsql . Logging ;
4042using IsolationLevel = System . Data . IsolationLevel ;
4143
@@ -47,8 +49,12 @@ namespace Npgsql
4749#if WITHDESIGN
4850 [ System . Drawing . ToolboxBitmapAttribute ( typeof ( NpgsqlConnection ) ) ]
4951#endif
52+ #if DNXCORE50
53+ public sealed class NpgsqlConnection : DbConnection
54+ #else
5055 [ System . ComponentModel . DesignerCategory ( "" ) ]
5156 public sealed class NpgsqlConnection : DbConnection , ICloneable
57+ #endif
5258 {
5359 #region Fields
5460
@@ -80,7 +86,13 @@ public sealed class NpgsqlConnection : DbConnection, ICloneable
8086 /// </summary>
8187 internal int OpenCounter { get ; private set ; }
8288
89+ #if ! DNXCORE50
90+ NpgsqlPromotableSinglePhaseNotification Promotable
91+ {
92+ get { return _promotable ?? ( _promotable = new NpgsqlPromotableSinglePhaseNotification ( this ) ) ; }
93+ }
8394 NpgsqlPromotableSinglePhaseNotification _promotable ;
95+ #endif
8496
8597 // A cached copy of the result of `settings.ConnectionString`
8698 string _connectionString ;
@@ -129,11 +141,13 @@ void Init()
129141 ProvideClientCertificatesCallbackDelegate = DefaultProvideClientCertificatesCallback ;
130142 ValidateRemoteCertificateCallbackDelegate = DefaultValidateRemoteCertificateCallback ;
131143
144+ #if ! DNXCORE50
132145 // Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
133146 // http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
134147 RSACryptoServiceProvider . UseMachineKeyStore = true ;
135148
136149 _promotable = new NpgsqlPromotableSinglePhaseNotification ( this ) ;
150+ #endif
137151 }
138152
139153 /// <summary>
@@ -184,10 +198,12 @@ public override void Open()
184198
185199 }*/
186200
201+ #if ! DNXCORE50
187202 if ( Enlist )
188203 {
189204 Promotable . Enlist ( Transaction . Current ) ;
190205 }
206+ #endif
191207
192208 OpenCounter ++ ;
193209 OnStateChange ( new StateChangeEventArgs ( ConnectionState . Closed , ConnectionState . Open ) ) ;
@@ -292,7 +308,9 @@ void RefreshConnectionString()
292308 /// <summary>
293309 /// Backend server host name.
294310 /// </summary>
311+ #if ! DNXCORE50
295312 [ Browsable ( true ) ]
313+ #endif
296314 public string Host
297315 {
298316 get { return _settings . Host ; }
@@ -301,7 +319,9 @@ public string Host
301319 /// <summary>
302320 /// Backend server port.
303321 /// </summary>
322+ #if ! DNXCORE50
304323 [ Browsable ( true ) ]
324+ #endif
305325 public int Port
306326 {
307327 get { return _settings . Port ; }
@@ -310,7 +330,9 @@ public int Port
310330 /// <summary>
311331 /// If true, the connection will attempt to use SSL.
312332 /// </summary>
333+ #if ! DNXCORE50
313334 [ Browsable ( true ) ]
335+ #endif
314336 public bool SSL
315337 {
316338 get { return _settings . SSL ; }
@@ -446,7 +468,9 @@ public int BufferSize
446468 /// Gets the current state of the connection.
447469 /// </summary>
448470 /// <value>A bitwise combination of the <see cref="System.Data.ConnectionState">ConnectionState</see> values. The default is <b>Closed</b>.</value>
471+ #if ! DNXCORE50
449472 [ Browsable ( false ) ]
473+ #endif
450474 public ConnectionState FullState
451475 {
452476 get
@@ -482,7 +506,9 @@ public ConnectionState FullState
482506 /// Gets whether the current state of the connection is Open or Closed
483507 /// </summary>
484508 /// <value>ConnectionState.Open, ConnectionState.Closed or ConnectionState.Connecting</value>
509+ #if ! DNXCORE50
485510 [ Browsable ( false ) ]
511+ #endif
486512 public override ConnectionState State
487513 {
488514 get
@@ -595,6 +621,7 @@ internal void PromotableLocalTransactionEnded()
595621 ReallyClose ( ) ;
596622 }
597623
624+ #if ! DNXCORE50
598625 /// <summary>
599626 /// Enlist transation.
600627 /// </summary>
@@ -603,6 +630,7 @@ public override void EnlistTransaction(Transaction transaction)
603630 {
604631 Promotable . Enlist ( transaction ) ;
605632 }
633+ #endif
606634
607635 #endregion
608636
@@ -624,11 +652,13 @@ public override void Close()
624652
625653 Log . Debug ( "Closing connection" , Connector . Id ) ;
626654
655+ #if ! DNXCORE50
627656 if ( _promotable != null && _promotable . InLocalTransaction )
628657 {
629658 _postponingClose = true ;
630659 return ;
631660 }
661+ #endif
632662
633663 ReallyClose ( ) ;
634664 }
@@ -792,7 +822,9 @@ internal bool DefaultValidateRemoteCertificateCallback(X509Certificate cert, X50
792822 /// Version of the PostgreSQL backend.
793823 /// This can only be called when there is an active connection.
794824 /// </summary>
825+ #if ! DNXCORE50
795826 [ Browsable ( false ) ]
827+ #endif
796828 public Version PostgreSqlVersion
797829 {
798830 get
@@ -815,7 +847,9 @@ public override string ServerVersion
815847 /// This can only be called when there is an active connection.
816848 /// Always retuna Version3
817849 /// </summary>
850+ #if ! DNXCORE50
818851 [ Browsable ( false ) ]
852+ #endif
819853 public ProtocolVersion BackendProtocolVersion
820854 {
821855 get
@@ -839,7 +873,9 @@ internal bool IsRedshift
839873 /// Process id of backend server.
840874 /// This can only be called when there is an active connection.
841875 /// </summary>
876+ #if ! DNXCORE50
842877 [ Browsable ( false ) ]
878+ #endif
843879 // ReSharper disable once InconsistentNaming
844880 public int ProcessID
845881 {
@@ -856,7 +892,9 @@ public int ProcessID
856892 /// In version 8.2, Postgres began supporting standard conformant strings, but defaulted this flag to false.
857893 /// As of version 9.1, this flag defaults to true.
858894 /// </summary>
895+ #if ! DNXCORE50
859896 [ Browsable ( false ) ]
897+ #endif
860898 public bool UseConformantStrings
861899 {
862900 get
@@ -869,7 +907,9 @@ public bool UseConformantStrings
869907 /// <summary>
870908 /// Report whether the backend understands the string literal E prefix (>= 8.1).
871909 /// </summary>
910+ #if ! DNXCORE50
872911 [ Browsable ( false ) ]
912+ #endif
873913 public bool Supports_E_StringPrefix
874914 {
875915 get
@@ -882,7 +922,9 @@ public bool Supports_E_StringPrefix
882922 /// <summary>
883923 /// Report whether the backend understands the hex byte format (>= 9.0).
884924 /// </summary>
925+ #if ! DNXCORE50
885926 [ Browsable ( false ) ]
927+ #endif
886928 public bool SupportsHexByteFormat
887929 {
888930 get
@@ -1085,11 +1127,6 @@ public static void RegisterEnumGlobally<TEnum>(string pgName = null) where TEnum
10851127
10861128 #region State checks
10871129
1088- NpgsqlPromotableSinglePhaseNotification Promotable
1089- {
1090- get { return _promotable ?? ( _promotable = new NpgsqlPromotableSinglePhaseNotification ( this ) ) ; }
1091- }
1092-
10931130 void CheckConnectionOpen ( )
10941131 {
10951132 if ( _disposed ) {
@@ -1153,7 +1190,7 @@ internal void CheckConnectionReady()
11531190 #endregion State checks
11541191
11551192 #region Schema operations
1156-
1193+ #if ! DNXCORE50
11571194 /// <summary>
11581195 /// Returns the supported collections
11591196 /// </summary>
@@ -1224,6 +1261,7 @@ public override DataTable GetSchema(string collectionName, string[] restrictions
12241261 }
12251262 }
12261263
1264+ #endif
12271265 #endregion Schema operations
12281266
12291267 #region Misc
@@ -1258,6 +1296,7 @@ public override void ChangeDatabase(String dbName)
12581296 Open ( ) ;
12591297 }
12601298
1299+ #if ! DNXCORE50
12611300 /// <summary>
12621301 /// Create a new connection based on this one.
12631302 /// </summary>
@@ -1266,6 +1305,7 @@ Object ICloneable.Clone()
12661305 {
12671306 return Clone ( ) ;
12681307 }
1308+ #endif
12691309
12701310 /// <summary>
12711311 /// Create a new connection based on this one.
@@ -1286,13 +1326,15 @@ public NpgsqlConnection Clone()
12861326 return clone ;
12871327 }
12881328
1329+ #if ! DNXCORE50
12891330 /// <summary>
12901331 /// DB provider factory.
12911332 /// </summary>
12921333 protected override DbProviderFactory DbProviderFactory
12931334 {
12941335 get { return NpgsqlFactory . Instance ; }
12951336 }
1337+ #endif
12961338
12971339 /// <summary>
12981340 /// Clear connection pool.
0 commit comments