Skip to content

Commit d46b8a2

Browse files
author
Jason Valdez
committed
Issue-2 Removed dead code
1 parent 643190b commit d46b8a2

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

src/IntegrationPostgreSqlTests/BulkLoading/SqlBulkCopyUtilitySpy.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public class SqlBulkCopyUtilitySpy: BulkLoader.ISqlBulkCopyUtility
1010

1111
public void BulkCopy<T>(string tableName,
1212
NpgsqlConnection conn,
13-
BulkLoader.SqlBulkCopyOptions options,
1413
BulkLoader.TargetProperty[] targetProperties,
1514
IEnumerable<T> toInsert)
1615
{
@@ -19,7 +18,6 @@ public void BulkCopy<T>(string tableName,
1918
new BulkLoader.SqlBulkCopyUtility()
2019
.BulkCopy(tableName,
2120
conn,
22-
options,
2321
targetProperties,
2422
toInsert);
2523
}

src/IntegrationShared/IntegrationCompatibilityTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<ProjectGuid>{C15AA0BA-7C38-4CCA-9BC1-2F530C051445}</ProjectGuid>
99
<OutputType>Library</OutputType>
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>IntegrationShared</RootNamespace>
12-
<AssemblyName>IntegrationShared</AssemblyName>
11+
<RootNamespace>ivaldez.Sql.IntegrationShared</RootNamespace>
12+
<AssemblyName>ivaldez.Sql.IntegrationShared</AssemblyName>
1313
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
1515
<Deterministic>true</Deterministic>

src/SharedTestFramework/SharedTestFramework.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<ProjectGuid>{692D1C7C-4403-468B-B2E8-51DA8EF0C654}</ProjectGuid>
88
<OutputType>Library</OutputType>
99
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>SharedTestFramework</RootNamespace>
11-
<AssemblyName>SharedTestFramework</AssemblyName>
10+
<RootNamespace>ivaldez.Sql.SharedTestFramework</RootNamespace>
11+
<AssemblyName>ivaldez.Sql.SharedTestFramework</AssemblyName>
1212
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<Deterministic>true</Deterministic>

src/ivaldez.SqlBulkLoader.PostgreSql/BulkLoader.cs

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)