@@ -112,23 +112,14 @@ public void Insert<T>(string tableName,
112112 bool noBatch = false )
113113 {
114114 var targetProperties = GetTargetProperties < T > ( propertiesToIgnore , renameFields ) ;
115-
116- //var options = SqlBulkCopyOptions.CheckConstraints | SqlBulkCopyOptions.TableLock;
117-
118- //if (keepIdentityColumnValue)
119- //{
120- // options |= SqlBulkCopyOptions.KeepIdentity;
121- //}
122-
123- SqlBulkCopyOptions options = null ;
124-
115+
125116 if ( noBatch )
126117 {
127- BulkCopyWithNoBatching ( tableName , conn , dataToInsert , options , targetProperties ) ;
118+ BulkCopyWithNoBatching ( tableName , conn , dataToInsert , targetProperties ) ;
128119 }
129120 else
130121 {
131- BulkCopyWithBatching ( tableName , conn , dataToInsert , batchSize , options , targetProperties ) ;
122+ BulkCopyWithBatching ( tableName , conn , dataToInsert , batchSize , targetProperties ) ;
132123 }
133124 }
134125
@@ -138,7 +129,7 @@ public void Insert<T>(string tableName,
138129 /// </summary>
139130 public class SqlBulkCopyUtility : ISqlBulkCopyUtility
140131 {
141- public void BulkCopy < T > ( string tableName , NpgsqlConnection conn , SqlBulkCopyOptions options ,
132+ public void BulkCopy < T > ( string tableName , NpgsqlConnection conn ,
142133 TargetProperty [ ] targetProperties , IEnumerable < T > toInsert )
143134 {
144135 var propertyList = new List < string > ( ) ;
@@ -173,7 +164,7 @@ public void BulkCopy<T>(string tableName, NpgsqlConnection conn, SqlBulkCopyOpti
173164 /// </summary>
174165 public interface ISqlBulkCopyUtility
175166 {
176- void BulkCopy < T > ( string tableName , NpgsqlConnection conn , SqlBulkCopyOptions options ,
167+ void BulkCopy < T > ( string tableName , NpgsqlConnection conn ,
177168 TargetProperty [ ] targetProperties , IEnumerable < T > toInsert ) ;
178169 }
179170
@@ -185,19 +176,14 @@ public class TargetProperty
185176 public string OriginalName { get ; set ; }
186177 }
187178
188- public class SqlBulkCopyOptions
189- {
190-
191- }
192-
193179 private void BulkCopyWithNoBatching < T > ( string tableName , NpgsqlConnection conn , IEnumerable < T > dataToInsert ,
194- SqlBulkCopyOptions options , TargetProperty [ ] targetProperties )
180+ TargetProperty [ ] targetProperties )
195181 {
196- _sqlBulkCopyUtility . BulkCopy ( tableName , conn , options , targetProperties , dataToInsert ) ;
182+ _sqlBulkCopyUtility . BulkCopy ( tableName , conn , targetProperties , dataToInsert ) ;
197183 }
198184
199185 private void BulkCopyWithBatching < T > ( string tableName , NpgsqlConnection conn , IEnumerable < T > dataToInsert , int batchSize ,
200- SqlBulkCopyOptions options , TargetProperty [ ] targetProperties )
186+ TargetProperty [ ] targetProperties )
201187 {
202188 var batch = new List < T > ( batchSize ) ;
203189
@@ -207,14 +193,14 @@ private void BulkCopyWithBatching<T>(string tableName, NpgsqlConnection conn, IE
207193
208194 if ( batch . Count >= batchSize )
209195 {
210- _sqlBulkCopyUtility . BulkCopy ( tableName , conn , options , targetProperties , batch ) ;
196+ _sqlBulkCopyUtility . BulkCopy ( tableName , conn , targetProperties , batch ) ;
211197 batch . Clear ( ) ;
212198 }
213199 }
214200
215201 if ( batch . Any ( ) )
216202 {
217- _sqlBulkCopyUtility . BulkCopy ( tableName , conn , options , targetProperties , batch ) ;
203+ _sqlBulkCopyUtility . BulkCopy ( tableName , conn , targetProperties , batch ) ;
218204 batch . Clear ( ) ;
219205 }
220206 }
0 commit comments