Skip to content

Commit 4288e9c

Browse files
committed
v0.4.1
1 parent ce39516 commit 4288e9c

8 files changed

Lines changed: 134 additions & 541 deletions

src/NuExt.System.Data.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
8-
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
8+
<GeneratePackageOnBuild Condition="'$(Configuration)' == 'Release'">true</GeneratePackageOnBuild>
99
<PackageTags>nuext;extensions;database;ado.net;async</PackageTags>
1010
<Description>Provides various extensions for data classes.
1111

@@ -17,7 +17,7 @@ System.Data.DataTableExtensions
1717
System.Data.DalBase
1818
System.Data.DbConverter&lt;TDbConnection&gt;
1919
System.Data.IDbContext</Description>
20-
<Version>0.4.0</Version>
20+
<Version>0.4.1</Version>
2121
<RootNamespace />
2222
<GenerateDocumentationFile>True</GenerateDocumentationFile>
2323
<NoWarn>$(NoWarn);1591;NETSDK1233</NoWarn>
@@ -31,7 +31,7 @@ System.Data.IDbContext</Description>
3131
</PropertyGroup>
3232

3333
<ItemGroup Condition="'$(UseNuExtPackages)' == 'true'">
34-
<PackageReference Include="NuExt.System" Version="0.4.0" />
34+
<PackageReference Include="NuExt.System" Version="0.4.1" />
3535
</ItemGroup>
3636

3737
<ItemGroup Condition="'$(UseNuExtPackages)' == 'false'">

src/System/Data/DalBase.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ protected bool TryCreateDbContext([NotNull] ref TDbContext? context)
6161
/// </exception>
6262
protected virtual ValueTask TryExecuteInDbContextAsync(TDbContext? context, Action<TDbContext> action, CancellationToken cancellationToken = default)
6363
{
64-
#if NET
6564
ArgumentNullException.ThrowIfNull(action);
66-
#else
67-
Throw.IfNull(action);
68-
#endif
65+
6966
bool contextTaken = TryCreateDbContext(ref context);
7067
try
7168
{
@@ -105,11 +102,8 @@ protected virtual ValueTask TryExecuteInDbContextAsync(TDbContext? context, Acti
105102
/// </exception>
106103
protected virtual async ValueTask TryExecuteInDbContextAsync(TDbContext? context, Func<TDbContext, ValueTask> action, CancellationToken cancellationToken = default)
107104
{
108-
#if NET
109105
ArgumentNullException.ThrowIfNull(action);
110-
#else
111-
Throw.IfNull(action);
112-
#endif
106+
113107
bool contextTaken = TryCreateDbContext(ref context);
114108
try
115109
{
@@ -149,11 +143,8 @@ protected virtual async ValueTask TryExecuteInDbContextAsync(TDbContext? context
149143
/// </exception>
150144
protected virtual ValueTask<T> TryExecuteInDbContextAsync<T>(TDbContext? context, Func<TDbContext, T> func, CancellationToken cancellationToken = default)
151145
{
152-
#if NET
153146
ArgumentNullException.ThrowIfNull(func);
154-
#else
155-
Throw.IfNull(func);
156-
#endif
147+
157148
bool contextTaken = TryCreateDbContext(ref context);
158149
try
159150
{
@@ -194,11 +185,8 @@ protected virtual ValueTask<T> TryExecuteInDbContextAsync<T>(TDbContext? context
194185
/// </exception>
195186
protected virtual async ValueTask<T> TryExecuteInDbContextAsync<T>(TDbContext? context, Func<TDbContext, ValueTask<T>> func, CancellationToken cancellationToken = default)
196187
{
197-
#if NET
198188
ArgumentNullException.ThrowIfNull(func);
199-
#else
200-
Throw.IfNull(func);
201-
#endif
189+
202190
bool contextTaken = TryCreateDbContext(ref context);
203191
try
204192
{

src/System/Data/DataReaderExtensions.Nullable.cs

Lines changed: 24 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ partial class DataReaderExtensions
66
{
77
public static bool? GetNullableBoolean(this DbDataReader reader, int ordinal)
88
{
9-
#if NET
109
ArgumentNullException.ThrowIfNull(reader);
11-
#else
12-
Throw.IfNull(reader);
13-
#endif
10+
1411
if (reader.IsDBNull(ordinal))
1512
{
1613
return null;
@@ -20,11 +17,8 @@ partial class DataReaderExtensions
2017

2118
public static bool? GetNullableBoolean(this DbDataReader reader, string name)
2219
{
23-
#if NET
2420
ArgumentNullException.ThrowIfNull(reader);
25-
#else
26-
Throw.IfNull(reader);
27-
#endif
21+
2822
int ordinal = reader.GetOrdinal(name);
2923
if (reader.IsDBNull(ordinal))
3024
{
@@ -35,11 +29,8 @@ partial class DataReaderExtensions
3529

3630
public static byte? GetNullableByte(this DbDataReader reader, int ordinal)
3731
{
38-
#if NET
3932
ArgumentNullException.ThrowIfNull(reader);
40-
#else
41-
Throw.IfNull(reader);
42-
#endif
33+
4334
if (reader.IsDBNull(ordinal))
4435
{
4536
return null;
@@ -49,11 +40,8 @@ partial class DataReaderExtensions
4940

5041
public static byte? GetNullableByte(this DbDataReader reader, string name)
5142
{
52-
#if NET
5343
ArgumentNullException.ThrowIfNull(reader);
54-
#else
55-
Throw.IfNull(reader);
56-
#endif
44+
5745
int ordinal = reader.GetOrdinal(name);
5846
if (reader.IsDBNull(ordinal))
5947
{
@@ -64,11 +52,8 @@ partial class DataReaderExtensions
6452

6553
public static char? GetNullableChar(this DbDataReader reader, int ordinal)
6654
{
67-
#if NET
6855
ArgumentNullException.ThrowIfNull(reader);
69-
#else
70-
Throw.IfNull(reader);
71-
#endif
56+
7257
if (reader.IsDBNull(ordinal))
7358
{
7459
return null;
@@ -78,11 +63,8 @@ partial class DataReaderExtensions
7863

7964
public static char? GetNullableChar(this DbDataReader reader, string name)
8065
{
81-
#if NET
8266
ArgumentNullException.ThrowIfNull(reader);
83-
#else
84-
Throw.IfNull(reader);
85-
#endif
67+
8668
int ordinal = reader.GetOrdinal(name);
8769
if (reader.IsDBNull(ordinal))
8870
{
@@ -93,11 +75,8 @@ partial class DataReaderExtensions
9375

9476
public static DateTime? GetNullableDateTime(this DbDataReader reader, int ordinal)
9577
{
96-
#if NET
9778
ArgumentNullException.ThrowIfNull(reader);
98-
#else
99-
Throw.IfNull(reader);
100-
#endif
79+
10180
if (reader.IsDBNull(ordinal))
10281
{
10382
return null;
@@ -107,11 +86,8 @@ partial class DataReaderExtensions
10786

10887
public static DateTime? GetNullableDateTime(this DbDataReader reader, string name)
10988
{
110-
#if NET
11189
ArgumentNullException.ThrowIfNull(reader);
112-
#else
113-
Throw.IfNull(reader);
114-
#endif
90+
11591
int ordinal = reader.GetOrdinal(name);
11692
if (reader.IsDBNull(ordinal))
11793
{
@@ -122,11 +98,8 @@ partial class DataReaderExtensions
12298

12399
public static decimal? GetNullableDecimal(this DbDataReader reader, int ordinal)
124100
{
125-
#if NET
126101
ArgumentNullException.ThrowIfNull(reader);
127-
#else
128-
Throw.IfNull(reader);
129-
#endif
102+
130103
if (reader.IsDBNull(ordinal))
131104
{
132105
return null;
@@ -136,11 +109,8 @@ partial class DataReaderExtensions
136109

137110
public static decimal? GetNullableDecimal(this DbDataReader reader, string name)
138111
{
139-
#if NET
140112
ArgumentNullException.ThrowIfNull(reader);
141-
#else
142-
Throw.IfNull(reader);
143-
#endif
113+
144114
int ordinal = reader.GetOrdinal(name);
145115
if (reader.IsDBNull(ordinal))
146116
{
@@ -151,11 +121,8 @@ partial class DataReaderExtensions
151121

152122
public static double? GetNullableDouble(this DbDataReader reader, int ordinal)
153123
{
154-
#if NET
155124
ArgumentNullException.ThrowIfNull(reader);
156-
#else
157-
Throw.IfNull(reader);
158-
#endif
125+
159126
if (reader.IsDBNull(ordinal))
160127
{
161128
return null;
@@ -165,11 +132,8 @@ partial class DataReaderExtensions
165132

166133
public static double? GetNullableDouble(this DbDataReader reader, string name)
167134
{
168-
#if NET
169135
ArgumentNullException.ThrowIfNull(reader);
170-
#else
171-
Throw.IfNull(reader);
172-
#endif
136+
173137
int ordinal = reader.GetOrdinal(name);
174138
if (reader.IsDBNull(ordinal))
175139
{
@@ -180,11 +144,8 @@ partial class DataReaderExtensions
180144

181145
public static float? GetNullableFloat(this DbDataReader reader, int ordinal)
182146
{
183-
#if NET
184147
ArgumentNullException.ThrowIfNull(reader);
185-
#else
186-
Throw.IfNull(reader);
187-
#endif
148+
188149
if (reader.IsDBNull(ordinal))
189150
{
190151
return null;
@@ -194,11 +155,8 @@ partial class DataReaderExtensions
194155

195156
public static float? GetNullableFloat(this DbDataReader reader, string name)
196157
{
197-
#if NET
198158
ArgumentNullException.ThrowIfNull(reader);
199-
#else
200-
Throw.IfNull(reader);
201-
#endif
159+
202160
int ordinal = reader.GetOrdinal(name);
203161
if (reader.IsDBNull(ordinal))
204162
{
@@ -209,11 +167,8 @@ partial class DataReaderExtensions
209167

210168
public static Guid? GetNullableGuid(this DbDataReader reader, int ordinal)
211169
{
212-
#if NET
213170
ArgumentNullException.ThrowIfNull(reader);
214-
#else
215-
Throw.IfNull(reader);
216-
#endif
171+
217172
if (reader.IsDBNull(ordinal))
218173
{
219174
return null;
@@ -223,11 +178,8 @@ partial class DataReaderExtensions
223178

224179
public static Guid? GetNullableGuid(this DbDataReader reader, string name)
225180
{
226-
#if NET
227181
ArgumentNullException.ThrowIfNull(reader);
228-
#else
229-
Throw.IfNull(reader);
230-
#endif
182+
231183
int ordinal = reader.GetOrdinal(name);
232184
if (reader.IsDBNull(ordinal))
233185
{
@@ -238,11 +190,8 @@ partial class DataReaderExtensions
238190

239191
public static short? GetNullableInt16(this DbDataReader reader, int ordinal)
240192
{
241-
#if NET
242193
ArgumentNullException.ThrowIfNull(reader);
243-
#else
244-
Throw.IfNull(reader);
245-
#endif
194+
246195
if (reader.IsDBNull(ordinal))
247196
{
248197
return null;
@@ -252,11 +201,8 @@ partial class DataReaderExtensions
252201

253202
public static short? GetNullableInt16(this DbDataReader reader, string name)
254203
{
255-
#if NET
256204
ArgumentNullException.ThrowIfNull(reader);
257-
#else
258-
Throw.IfNull(reader);
259-
#endif
205+
260206
int ordinal = reader.GetOrdinal(name);
261207
if (reader.IsDBNull(ordinal))
262208
{
@@ -267,11 +213,8 @@ partial class DataReaderExtensions
267213

268214
public static int? GetNullableInt32(this DbDataReader reader, int ordinal)
269215
{
270-
#if NET
271216
ArgumentNullException.ThrowIfNull(reader);
272-
#else
273-
Throw.IfNull(reader);
274-
#endif
217+
275218
if (reader.IsDBNull(ordinal))
276219
{
277220
return null;
@@ -281,11 +224,8 @@ partial class DataReaderExtensions
281224

282225
public static int? GetNullableInt32(this DbDataReader reader, string name)
283226
{
284-
#if NET
285227
ArgumentNullException.ThrowIfNull(reader);
286-
#else
287-
Throw.IfNull(reader);
288-
#endif
228+
289229
int ordinal = reader.GetOrdinal(name);
290230
if (reader.IsDBNull(ordinal))
291231
{
@@ -296,11 +236,8 @@ partial class DataReaderExtensions
296236

297237
public static long? GetNullableInt64(this DbDataReader reader, int ordinal)
298238
{
299-
#if NET
300239
ArgumentNullException.ThrowIfNull(reader);
301-
#else
302-
Throw.IfNull(reader);
303-
#endif
240+
304241
if (reader.IsDBNull(ordinal))
305242
{
306243
return null;
@@ -310,11 +247,8 @@ partial class DataReaderExtensions
310247

311248
public static long? GetNullableInt64(this DbDataReader reader, string name)
312249
{
313-
#if NET
314250
ArgumentNullException.ThrowIfNull(reader);
315-
#else
316-
Throw.IfNull(reader);
317-
#endif
251+
318252
int ordinal = reader.GetOrdinal(name);
319253
if (reader.IsDBNull(ordinal))
320254
{
@@ -325,11 +259,8 @@ partial class DataReaderExtensions
325259

326260
public static string? GetNullableString(this DbDataReader reader, int ordinal)
327261
{
328-
#if NET
329262
ArgumentNullException.ThrowIfNull(reader);
330-
#else
331-
Throw.IfNull(reader);
332-
#endif
263+
333264
if (reader.IsDBNull(ordinal))
334265
{
335266
return null;
@@ -339,11 +270,8 @@ partial class DataReaderExtensions
339270

340271
public static string? GetNullableString(this DbDataReader reader, string name)
341272
{
342-
#if NET
343273
ArgumentNullException.ThrowIfNull(reader);
344-
#else
345-
Throw.IfNull(reader);
346-
#endif
274+
347275
int ordinal = reader.GetOrdinal(name);
348276
if (reader.IsDBNull(ordinal))
349277
{

0 commit comments

Comments
 (0)