@@ -21,11 +21,8 @@ public SQLiteDataAdapter CreateAdapter(SQLiteCommand command)
2121 {
2222 CheckDisposed ( ) ;
2323 Debug . Assert ( command != null , $ "{ nameof ( command ) } is null") ;
24- #if NET6_0_OR_GREATER
2524 ArgumentNullException . ThrowIfNull ( command ) ;
26- #else
27- Throw . IfNull ( command ) ;
28- #endif
25+
2926 return new SQLiteDataAdapter ( ) { SelectCommand = command } ;
3027 }
3128
@@ -36,32 +33,21 @@ public SQLiteDataAdapter CreateAdapter(SQLiteCommand command)
3633 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
3734 public DataTable Select ( string tableName , IEnumerable < string > fields , string ? expr = null , CancellationToken cancellationToken = default , params SQLiteParameter [ ] parameters )
3835 {
39- #if NET8_0_OR_GREATER
4036 ArgumentException . ThrowIfNullOrEmpty ( tableName ) ;
41- #else
42- Throw . IfNullOrEmpty ( tableName ) ;
43- #endif
4437 return Select ( CreateCommandSelect ( tableName , fields , expr , parameters ) , cancellationToken ) ;
4538 }
4639
4740 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
4841 public DataTable Select ( string sql , CancellationToken cancellationToken = default , params SQLiteParameter [ ] parameters )
4942 {
50- #if NET8_0_OR_GREATER
5143 ArgumentException . ThrowIfNullOrEmpty ( sql ) ;
52- #else
53- Throw . IfNullOrEmpty ( sql ) ;
54- #endif
5544 return Select ( CreateCommand ( sql , parameters ) , cancellationToken ) ;
5645 }
5746
5847 public DataTable Select ( SQLiteCommand command , CancellationToken cancellationToken = default )
5948 {
60- #if NET6_0_OR_GREATER
6149 ArgumentNullException . ThrowIfNull ( command ) ;
62- #else
63- Throw . IfNull ( command ) ;
64- #endif
50+
6551 using var adapter = CreateAdapter ( ) ;
6652 try
6753 {
@@ -84,32 +70,20 @@ public DataTable Select(SQLiteCommand command, CancellationToken cancellationTok
8470 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
8571 public ( SQLiteDataAdapter Adapter , DataTable Table ) SelectForUpdate ( string tableName , IEnumerable < string > fields , string ? expr = null , bool generateCommands = true , CancellationToken cancellationToken = default , params SQLiteParameter [ ] parameters )
8672 {
87- #if NET8_0_OR_GREATER
8873 ArgumentException . ThrowIfNullOrEmpty ( tableName ) ;
89- #else
90- Throw . IfNullOrEmpty ( tableName ) ;
91- #endif
9274 return SelectForUpdate ( CreateCommandSelect ( tableName , fields , expr , parameters ) , generateCommands , cancellationToken ) ;
9375 }
9476
9577 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
9678 public ( SQLiteDataAdapter Adapter , DataTable Table ) SelectForUpdate ( string sql , bool generateCommands = true , CancellationToken cancellationToken = default , params SQLiteParameter [ ] parameters )
9779 {
98- #if NET8_0_OR_GREATER
9980 ArgumentException . ThrowIfNullOrEmpty ( sql ) ;
100- #else
101- Throw . IfNullOrEmpty ( sql ) ;
102- #endif
10381 return SelectForUpdate ( CreateCommand ( sql , parameters ) , generateCommands , cancellationToken ) ;
10482 }
10583
10684 public ( SQLiteDataAdapter Adapter , DataTable Table ) SelectForUpdate ( SQLiteCommand command , bool generateCommands = true , CancellationToken cancellationToken = default )
10785 {
108- #if NET6_0_OR_GREATER
10986 ArgumentNullException . ThrowIfNull ( command ) ;
110- #else
111- Throw . IfNull ( command ) ;
112- #endif
11387 var adapter = CreateAdapter ( ) ;
11488 try
11589 {
@@ -144,13 +118,8 @@ public DataTable Select(SQLiteCommand command, CancellationToken cancellationTok
144118
145119 public void Fill ( SQLiteDataAdapter adapter , DataTable table , CancellationToken cancellationToken = default )
146120 {
147- #if NET6_0_OR_GREATER
148121 ArgumentNullException . ThrowIfNull ( adapter ) ;
149122 ArgumentNullException . ThrowIfNull ( table ) ;
150- #else
151- Throw . IfNull ( adapter ) ;
152- Throw . IfNull ( table ) ;
153- #endif
154123
155124 AcquireLock ( ( ) => adapter . Fill ( table ) , cancellationToken ) ;
156125 }
@@ -161,13 +130,9 @@ public void Fill(SQLiteDataAdapter adapter, DataTable table, CancellationToken c
161130
162131 public int Update ( SQLiteDataAdapter adapter , DataTable table , CancellationToken cancellationToken = default )
163132 {
164- #if NET6_0_OR_GREATER
165133 ArgumentNullException . ThrowIfNull ( adapter ) ;
166134 ArgumentNullException . ThrowIfNull ( table ) ;
167- #else
168- Throw . IfNull ( adapter ) ;
169- Throw . IfNull ( table ) ;
170- #endif
135+
171136 //Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
172137 return AcquireLock ( ( ) => adapter . Update ( table ) , cancellationToken ) ;
173138 }
0 commit comments