Skip to content

Commit e461037

Browse files
committed
Cosmetics in NpgsqlDataAdapter
1 parent 1d3f9dc commit e461037

1 file changed

Lines changed: 22 additions & 62 deletions

File tree

src/Npgsql/NpgsqlDataAdapter.cs

Lines changed: 22 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#if NET45 || NET451
21
#region License
32
// The PostgreSQL License
43
//
@@ -22,10 +21,11 @@
2221
// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
2322
#endregion
2423

24+
#if NET45 || NET451
25+
2526
using System;
2627
using System.Data;
2728
using System.Data.Common;
28-
using System.Reflection;
2929
using JetBrains.Annotations;
3030
using Npgsql.Logging;
3131

@@ -67,9 +67,7 @@ public sealed class NpgsqlDataAdapter : DbDataAdapter
6767
/// <summary>
6868
/// Default constructor.
6969
/// </summary>
70-
public NpgsqlDataAdapter()
71-
{
72-
}
70+
public NpgsqlDataAdapter() {}
7371

7472
/// <summary>
7573
/// Constructor.
@@ -86,32 +84,23 @@ public NpgsqlDataAdapter(NpgsqlCommand selectCommand)
8684
/// </summary>
8785
/// <param name="selectCommandText"></param>
8886
/// <param name="selectConnection"></param>
89-
public NpgsqlDataAdapter(String selectCommandText, NpgsqlConnection selectConnection)
90-
: this(new NpgsqlCommand(selectCommandText, selectConnection))
91-
{
92-
}
87+
public NpgsqlDataAdapter(string selectCommandText, NpgsqlConnection selectConnection)
88+
: this(new NpgsqlCommand(selectCommandText, selectConnection)) {}
9389

9490
/// <summary>
9591
/// Constructor.
9692
/// </summary>
9793
/// <param name="selectCommandText"></param>
9894
/// <param name="selectConnectionString"></param>
99-
public NpgsqlDataAdapter(String selectCommandText, String selectConnectionString)
100-
: this(selectCommandText, new NpgsqlConnection(selectConnectionString))
101-
{
102-
}
95+
public NpgsqlDataAdapter(string selectCommandText, string selectConnectionString)
96+
: this(selectCommandText, new NpgsqlConnection(selectConnectionString)) {}
10397

10498
/// <summary>
10599
/// Create row updated event.
106100
/// </summary>
107-
/// <param name="dataRow"></param>
108-
/// <param name="command"></param>
109-
/// <param name="statementType"></param>
110-
/// <param name="tableMapping"></param>
111-
/// <returns></returns>
112-
protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand command,
101+
protected override RowUpdatedEventArgs CreateRowUpdatedEvent([NotNull] DataRow dataRow, [NotNull] IDbCommand command,
113102
System.Data.StatementType statementType,
114-
DataTableMapping tableMapping)
103+
[NotNull] DataTableMapping tableMapping)
115104
{
116105
Log.Trace("CreateRowUpdatedEvent");
117106
return new NpgsqlRowUpdatedEventArgs(dataRow, command, statementType, tableMapping);
@@ -120,14 +109,9 @@ protected override RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, ID
120109
/// <summary>
121110
/// Create row updating event.
122111
/// </summary>
123-
/// <param name="dataRow"></param>
124-
/// <param name="command"></param>
125-
/// <param name="statementType"></param>
126-
/// <param name="tableMapping"></param>
127-
/// <returns></returns>
128-
protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand command,
112+
protected override RowUpdatingEventArgs CreateRowUpdatingEvent([NotNull] DataRow dataRow, [NotNull] IDbCommand command,
129113
System.Data.StatementType statementType,
130-
DataTableMapping tableMapping)
114+
[NotNull] DataTableMapping tableMapping)
131115
{
132116
Log.Trace("CreateRowUpdatingEvent");
133117
return new NpgsqlRowUpdatingEventArgs(dataRow, command, statementType, tableMapping);
@@ -137,39 +121,31 @@ protected override RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow,
137121
/// Raise the RowUpdated event.
138122
/// </summary>
139123
/// <param name="value"></param>
140-
protected override void OnRowUpdated(RowUpdatedEventArgs value)
124+
protected override void OnRowUpdated([NotNull] RowUpdatedEventArgs value)
141125
{
142126
Log.Trace("OnRowUpdated");
143127
//base.OnRowUpdated(value);
144-
if ((RowUpdated != null) && (value is NpgsqlRowUpdatedEventArgs))
145-
{
146-
RowUpdated(this, (NpgsqlRowUpdatedEventArgs) value);
147-
}
128+
if (RowUpdated != null && value is NpgsqlRowUpdatedEventArgs)
129+
RowUpdated(this, (NpgsqlRowUpdatedEventArgs)value);
148130
}
149131

150132
/// <summary>
151133
/// Raise the RowUpdating event.
152134
/// </summary>
153135
/// <param name="value"></param>
154-
protected override void OnRowUpdating(RowUpdatingEventArgs value)
136+
protected override void OnRowUpdating([NotNull] RowUpdatingEventArgs value)
155137
{
156138
Log.Trace("OnRowUpdating");
157-
if ((RowUpdating != null) && (value is NpgsqlRowUpdatingEventArgs))
158-
{
139+
if (RowUpdating != null && value is NpgsqlRowUpdatingEventArgs)
159140
RowUpdating(this, (NpgsqlRowUpdatingEventArgs) value);
160-
}
161141
}
162142

163143
/// <summary>
164144
/// Delete command.
165145
/// </summary>
166146
public new NpgsqlCommand DeleteCommand
167147
{
168-
get
169-
{
170-
return (NpgsqlCommand)base.DeleteCommand;
171-
}
172-
148+
get { return (NpgsqlCommand)base.DeleteCommand; }
173149
set { base.DeleteCommand = value; }
174150
}
175151

@@ -178,11 +154,7 @@ protected override void OnRowUpdating(RowUpdatingEventArgs value)
178154
/// </summary>
179155
public new NpgsqlCommand SelectCommand
180156
{
181-
get
182-
{
183-
return (NpgsqlCommand)base.SelectCommand;
184-
}
185-
157+
get { return (NpgsqlCommand)base.SelectCommand; }
186158
set { base.SelectCommand = value; }
187159
}
188160

@@ -191,11 +163,7 @@ protected override void OnRowUpdating(RowUpdatingEventArgs value)
191163
/// </summary>
192164
public new NpgsqlCommand UpdateCommand
193165
{
194-
get
195-
{
196-
return (NpgsqlCommand)base.UpdateCommand;
197-
}
198-
166+
get { return (NpgsqlCommand)base.UpdateCommand; }
199167
set { base.UpdateCommand = value; }
200168
}
201169

@@ -204,11 +172,7 @@ protected override void OnRowUpdating(RowUpdatingEventArgs value)
204172
/// </summary>
205173
public new NpgsqlCommand InsertCommand
206174
{
207-
get
208-
{
209-
return (NpgsqlCommand)base.InsertCommand;
210-
}
211-
175+
get { return (NpgsqlCommand)base.InsertCommand; }
212176
set { base.InsertCommand = value; }
213177
}
214178
}
@@ -219,18 +183,14 @@ public class NpgsqlRowUpdatingEventArgs : RowUpdatingEventArgs
219183
{
220184
public NpgsqlRowUpdatingEventArgs(DataRow dataRow, IDbCommand command, System.Data.StatementType statementType,
221185
DataTableMapping tableMapping)
222-
: base(dataRow, command, statementType, tableMapping)
223-
{
224-
}
186+
: base(dataRow, command, statementType, tableMapping) {}
225187
}
226188

227189
public class NpgsqlRowUpdatedEventArgs : RowUpdatedEventArgs
228190
{
229191
public NpgsqlRowUpdatedEventArgs(DataRow dataRow, IDbCommand command, System.Data.StatementType statementType,
230192
DataTableMapping tableMapping)
231-
: base(dataRow, command, statementType, tableMapping)
232-
{
233-
}
193+
: base(dataRow, command, statementType, tableMapping) {}
234194
}
235195

236196
#pragma warning restore 1591

0 commit comments

Comments
 (0)