Skip to content

Commit 6ac9b15

Browse files
committed
Cosmetics
1 parent 0fe1da8 commit 6ac9b15

37 files changed

+113
-151
lines changed

src/Npgsql/BackendMessages/ErrorOrNoticeMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
using System;
2525
using System.Diagnostics.Contracts;
2626
using Npgsql.Logging;
27-
#if NET45 || NET451 || DNX451
27+
#if NET45 || NET451
2828
using System.Runtime.Serialization;
2929
#endif
3030

3131
namespace Npgsql.BackendMessages
3232
{
33-
#if NET45 || NET451 || DNX451
33+
#if NET45 || NET451
3434
[Serializable]
3535
#endif
3636
class ErrorOrNoticeMessage

src/Npgsql/BackendMessages/RowDescriptionMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public bool Equals(string x, string y)
124124
}
125125
public int GetHashCode(string obj)
126126
{
127-
#if NET45 || NET451 || DNX451
127+
#if NET45 || NET451
128128
return CompareInfo.GetSortKey(obj, CompareOptions.IgnoreWidth).GetHashCode();
129129
#else
130130
return CompareInfo.GetHashCode(obj, CompareOptions.IgnoreWidth);
@@ -142,7 +142,7 @@ public bool Equals(string x, string y)
142142
}
143143
public int GetHashCode(string obj)
144144
{
145-
#if NET45 || NET451 || DNX451
145+
#if NET45 || NET451
146146
return CompareInfo.GetSortKey(obj, CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase).GetHashCode();
147147
#else
148148
return CompareInfo.GetHashCode(obj, CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase);

src/Npgsql/GeneratedAsync.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
using System.Threading;
3434
using System.Threading.Tasks;
3535
using JetBrains.Annotations;
36-
#if NET45 || NET451 || DNX451
36+
#if NET45 || NET451
3737
using System.Transactions;
3838
#endif
3939
using Npgsql.Logging;
@@ -385,7 +385,7 @@ async Task OpenInternalAsync(CancellationToken cancellationToken)
385385

386386
Connector.Notice += _noticeDelegate;
387387
Connector.Notification += _notificationDelegate;
388-
#if NET45 || NET451 || DNX451
388+
#if NET45 || NET451
389389
if (Settings.Enlist)
390390
{
391391
Promotable.Enlist(Transaction.Current);
@@ -891,7 +891,7 @@ async Task<bool> NextResultInternalAsync(CancellationToken cancellationToken)
891891

892892
Contract.Assert(_state == ReaderState.BetweenResults);
893893
_hasRows = null;
894-
#if NET45 || NET451 || DNX451
894+
#if NET45 || NET451
895895
_cachedSchemaTable = null;
896896
#endif
897897
if ((_behavior & CommandBehavior.SingleResult) != 0 && _statementIndex == 0)

src/Npgsql/Logging/NpgsqlLogManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ internal static NpgsqlLogger GetCurrentClassLogger()
7777
// Copied from NLog
7878
static string GetClassFullName()
7979
{
80-
#if NET45 || NET451 || DNX451
80+
#if NET45 || NET451
8181
string className;
8282
Type declaringType;
8383
int framesToSkip = 2;

src/Npgsql/NpgsqlCommand.cs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -924,10 +924,7 @@ bool PopulateDeallocate(ref DirectBuffer directBuf)
924924
/// Executes a SQL statement against the connection and returns the number of rows affected.
925925
/// </summary>
926926
/// <returns>The number of rows affected if known; -1 otherwise.</returns>
927-
public override int ExecuteNonQuery()
928-
{
929-
return ExecuteNonQueryInternal();
930-
}
927+
public override int ExecuteNonQuery() => ExecuteNonQueryInternal();
931928

932929
/// <summary>
933930
/// Asynchronous version of <see cref="ExecuteNonQuery"/>
@@ -982,10 +979,7 @@ int ExecuteNonQueryInternal()
982979
/// <returns>The first column of the first row in the result set,
983980
/// or a null reference if the result set is empty.</returns>
984981
[CanBeNull]
985-
public override object ExecuteScalar()
986-
{
987-
return ExecuteScalarInternal();
988-
}
982+
public override object ExecuteScalar() => ExecuteScalarInternal();
989983

990984
/// <summary>
991985
/// Asynchronous version of <see cref="ExecuteScalar"/>
@@ -1022,9 +1016,7 @@ object ExecuteScalarInternal()
10221016
{
10231017
var behavior = CommandBehavior.SequentialAccess | CommandBehavior.SingleRow;
10241018
using (var reader = Execute(behavior))
1025-
{
10261019
return reader.Read() && reader.FieldCount != 0 ? reader.GetValue(0) : null;
1027-
}
10281020
}
10291021
}
10301022

@@ -1040,10 +1032,7 @@ object ExecuteScalarInternal()
10401032
/// DataReader.
10411033
/// </remarks>
10421034
/// <returns>A DbDataReader object.</returns>
1043-
public new NpgsqlDataReader ExecuteReader()
1044-
{
1045-
return (NpgsqlDataReader) base.ExecuteReader();
1046-
}
1035+
public new NpgsqlDataReader ExecuteReader() => (NpgsqlDataReader) base.ExecuteReader();
10471036

10481037
/// <summary>
10491038
/// Executes the CommandText against the Connection, and returns an DbDataReader using one
@@ -1054,18 +1043,15 @@ object ExecuteScalarInternal()
10541043
/// DataReader.
10551044
/// </remarks>
10561045
/// <returns>A DbDataReader object.</returns>
1057-
public new NpgsqlDataReader ExecuteReader(CommandBehavior behavior)
1058-
{
1059-
return (NpgsqlDataReader) base.ExecuteReader(behavior);
1060-
}
1046+
public new NpgsqlDataReader ExecuteReader(CommandBehavior behavior) => (NpgsqlDataReader) base.ExecuteReader(behavior);
10611047

10621048
/// <summary>
10631049
/// Executes the command text against the connection.
10641050
/// </summary>
10651051
/// <param name="behavior">An instance of <see cref="CommandBehavior"/>.</param>
10661052
/// <param name="cancellationToken">A task representing the operation.</param>
10671053
/// <returns></returns>
1068-
protected async override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
1054+
protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
10691055
{
10701056
cancellationToken.ThrowIfCancellationRequested();
10711057
using (cancellationToken.Register(Cancel))
@@ -1086,10 +1072,8 @@ protected async override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBeha
10861072
/// <summary>
10871073
/// Executes the command text against the connection.
10881074
/// </summary>
1089-
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
1090-
{
1091-
return ExecuteDbDataReaderInternal(behavior);
1092-
}
1075+
[NotNull]
1076+
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) => ExecuteDbDataReaderInternal(behavior);
10931077

10941078
[MethodImpl(MethodImplOptions.AggressiveInlining)]
10951079
[RewriteAsync]
@@ -1252,7 +1236,7 @@ void LogCommand()
12521236
Log.Debug(sb.ToString(), Connection.Connector.Id);
12531237
}
12541238

1255-
#if NET45 || NET451 || DNX451
1239+
#if NET45 || NET451
12561240
/// <summary>
12571241
/// Create a new command based on this one.
12581242
/// </summary>

src/Npgsql/NpgsqlCommandBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET45 || NET451 || DNX451
1+
#if NET45 || NET451
22

33
#region License
44
// The PostgreSQL License

src/Npgsql/NpgsqlConnection.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
using System.Threading.Tasks;
3737
using AsyncRewriter;
3838
using JetBrains.Annotations;
39-
#if NET45 || NET451 || DNX451
39+
#if NET45 || NET451
4040
using System.Transactions;
4141
#endif
4242
using Npgsql.Logging;
@@ -100,7 +100,7 @@ public sealed partial class NpgsqlConnection : DbConnection, ICloneable
100100

101101
bool _wasBroken;
102102

103-
#if NET45 || NET451 || DNX451
103+
#if NET45 || NET451
104104
NpgsqlPromotableSinglePhaseNotification Promotable => _promotable ?? (_promotable = new NpgsqlPromotableSinglePhaseNotification(this));
105105
NpgsqlPromotableSinglePhaseNotification _promotable;
106106
#endif
@@ -153,7 +153,7 @@ void Init()
153153
_noticeDelegate = OnNotice;
154154
_notificationDelegate = OnNotification;
155155

156-
#if NET45 || NET451 || DNX451
156+
#if NET45 || NET451
157157
// Fix authentication problems. See https://bugzilla.novell.com/show_bug.cgi?id=MONO77559 and
158158
// http://pgfoundry.org/forum/message.php?msg_id=1002377 for more info.
159159
RSACryptoServiceProvider.UseMachineKeyStore = true;
@@ -166,8 +166,7 @@ void Init()
166166
/// Opens a database connection with the property settings specified by the
167167
/// <see cref="NpgsqlConnection.ConnectionString">ConnectionString</see>.
168168
/// </summary>
169-
public override void Open()
170-
=> OpenInternal();
169+
public override void Open() => OpenInternal();
171170

172171
/// <summary>
173172
/// This is the asynchronous version of <see cref="Open"/>.
@@ -177,8 +176,7 @@ public override void Open()
177176
/// </remarks>
178177
/// <param name="cancellationToken">The cancellation instruction.</param>
179178
/// <returns>A task representing the asynchronous operation.</returns>
180-
public override Task OpenAsync(CancellationToken cancellationToken)
181-
=> OpenInternalAsync(cancellationToken);
179+
public override Task OpenAsync(CancellationToken cancellationToken) => OpenInternalAsync(cancellationToken);
182180

183181
[RewriteAsync]
184182
void OpenInternal()
@@ -235,7 +233,7 @@ void OpenInternal()
235233
Connector.Notice += _noticeDelegate;
236234
Connector.Notification += _notificationDelegate;
237235

238-
#if NET45 || NET451 || DNX451
236+
#if NET45 || NET451
239237
if (Settings.Enlist)
240238
{
241239
Promotable.Enlist(Transaction.Current);
@@ -521,7 +519,7 @@ internal void PromotableLocalTransactionEnded()
521519
ReallyClose();
522520
}
523521

524-
#if NET45 || NET451 || DNX451
522+
#if NET45 || NET451
525523
/// <summary>
526524
/// Enlist transation.
527525
/// </summary>
@@ -552,7 +550,7 @@ public override void Close()
552550

553551
Log.Trace("Closing connection", Connector.Id);
554552

555-
#if NET45 || NET451 || DNX451
553+
#if NET45 || NET451
556554
if (_promotable != null && _promotable.InLocalTransaction)
557555
{
558556
_postponingClose = true;
@@ -570,7 +568,7 @@ internal void ReallyClose(bool wasBroken=false)
570568
_postponingClose = false;
571569
_wasBroken = wasBroken;
572570

573-
#if NET45 || NET451 || DNX451
571+
#if NET45 || NET451
574572
// clear the way for another promotable transaction
575573
_promotable = null;
576574
#endif
@@ -1287,7 +1285,7 @@ internal void CheckReady()
12871285
#endregion State checks
12881286

12891287
#region Schema operations
1290-
#if NET45 || NET451 || DNX451
1288+
#if NET45 || NET451
12911289
/// <summary>
12921290
/// Returns the supported collections
12931291
/// </summary>
@@ -1363,7 +1361,7 @@ public override DataTable GetSchema([CanBeNull] string collectionName, [CanBeNul
13631361

13641362
#region Misc
13651363

1366-
#if NET45 || NET451 || DNX451
1364+
#if NET45 || NET451
13671365
object ICloneable.Clone()
13681366
{
13691367
CheckNotDisposed();
@@ -1420,7 +1418,7 @@ public override void ChangeDatabase(String dbName)
14201418
Open();
14211419
}
14221420

1423-
#if NET45 || NET451 || DNX451
1421+
#if NET45 || NET451
14241422
/// <summary>
14251423
/// DB provider factory.
14261424
/// </summary>

src/Npgsql/NpgsqlConnectionStringBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
using System.Linq;
3030
using System.Reflection;
3131
using JetBrains.Annotations;
32-
#if NET45 || NET451 || DNX451
32+
#if NET45 || NET451
3333
using System.DirectoryServices;
3434
using System.Security.Principal;
3535
#endif
@@ -71,7 +71,7 @@ public sealed class NpgsqlConnectionStringBuilder : DbConnectionStringBuilder
7171
/// </summary>
7272
public NpgsqlConnectionStringBuilder() { Init(); }
7373

74-
#if NET45 || NET451 || DNX451
74+
#if NET45 || NET451
7575
/// <summary>
7676
/// Initializes a new instance of the NpgsqlConnectionStringBuilder class, optionally using ODBC rules for quoting values.
7777
/// </summary>

0 commit comments

Comments
 (0)