Skip to content

Commit dfc9e88

Browse files
committed
Updated release notes and Version for publishing to Nuget.
1 parent c059a82 commit dfc9e88

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

NetStandard.SqlBulkHelpers/NetStandard.SqlBulkHelpers.csproj

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@
1313
<Description>A library for easy, efficient and high performance bulk insert and update of data, into a Sql Database, from .Net applications. By leveraging the power of the SqlBulkCopy classes with added support for Identity primary key table columns this library provides a greatly simplified interface to process Identity based Entities with Bulk Performance with the wide compatibility of .NetStandard 2.0.</Description>
1414
<PackageTags>sql server database table bulk insert update identity column sqlbulkcopy orm dapper linq2sql materialization materialized data view materialized-data materialized-view sync replication replica readonly</PackageTags>
1515
<PackageReleaseNotes>
16-
- Added additional convenience methods to the `MaterializationContext` to retreive loading table info for models mapped via annotations (ModelType; vs only ordinal or string name).
17-
- Added support to cancel the materialization process via new `MaterializationContext.CancelMaterializationProcess()` method; allows passive cancelling without the need to throw an exception to safely stop the process.
18-
- Fixed small configuration initialization bugs when manually setting the `IsFullTextIndexHandlingEnabled` flag.
19-
- Fixed small bug where default configuration was not being used as the fallback.
16+
- Added support for other Identity column data types including (INT, BIGINT, SMALLINT, &amp; TINYINT); per feature request (https://github.com/cajuncoding/SqlBulkHelpers/issues/10).
17+
- Added support to explicitly set Identity Values (aka SET IDENTITY_INSERT ON) via new `enableIdentityInsert` api parameter.
18+
- Added support to retreive and re-seed (aka set) the current Identity Value on a given table via new apis in the MaterializedData helpers.
19+
- Additional small bug fixes and optimiaztions.
2020

2121
Prior Relese Notes:
22+
- Added additional convenience methods to the `MaterializationContext` to retreive loading table info for models mapped via annotations (ModelType; vs only ordinal or string name).
23+
- Added support to cancel the materialization process via new `MaterializationContext.CancelMaterializationProcess()` method; allows passive cancelling without the need to throw an exception to safely stop the process.
24+
- Fixed small configuration initialization bugs when manually setting the `IsFullTextIndexHandlingEnabled` flag.
25+
- Fixed small bug where default configuration was not being used as the fallback.
2226
- Improve configuration of Timeouts and add support for Default DB Schema Loader timeout setting.
2327
- v2.0 provides a simplified and easier to access API as Extension Methods of the SqlTransaction class; this is a breaking change for Sql Bulk Insert/Update/etc, but shoudl be easy to migrate to!
2428
- v2.0 release also includes the NEW MaterializeData Helpers to make it significantly easier to implement highly efficient loading and publishing of materialized data via Sql Server much easier via an easy C# API.
@@ -43,7 +47,7 @@
4347
- Added more Integration Tests for Constructors and Connections, as well as the new DB Schema Loader caching implementation.
4448
- Fixed bug in dynamic initialization of SqlBulkHelpersConnectionProvider and SqlBulkHelpersDBSchemaLoader when not using the Default instances that automtically load the connection string from the application configuration setting.
4549
</PackageReleaseNotes>
46-
<Version>2.1</Version>
50+
<Version>2.2</Version>
4751
</PropertyGroup>
4852

4953
<ItemGroup>

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ public class TestDataService
215215
## Nuget Package
216216
To use in your project, add the [SqlBulkHelpers NuGet package](https://www.nuget.org/packages/SqlBulkHelpers/) to your project.
217217

218+
## v2.2 Release Notes:
219+
- Added support for other Identity column data types including (INT, BIGINT, SMALLINT, & TINYINT); per [feature request here](https://github.com/cajuncoding/SqlBulkHelpers/issues/10).
220+
- Added support to explicitly set Identity Values (aka SET IDENTITY_INSERT ON) via new `enableIdentityInsert` api parameter.
221+
- Added support to retreive and re-seed (aka set) the current Identity Value on a given table via new apis in the MaterializedData helpers.
222+
- Additional small bug fixes and optimiaztions.
223+
224+
218225
## v2.1 Release Notes:
219226
- Added additional convenience methods to the `MaterializationContext` to retreive loading table info for models mapped via annotations (ModelType; vs only ordinal or string name).
220227
- Added support to cancel the materialization process via new `MaterializationContext.CancelMaterializationProcess()` method; allows passive cancelling without the need to throw an exception to safely stop the process.
@@ -389,6 +396,33 @@ disabled by setting the `SqlMergeMatchQualifierExpression.ThrowExceptionIfNonUni
389396

390397
```
391398

399+
### Explicitly setting Identity Values (aka SET IDENTITY_INSERT ON):
400+
The normal process is for Identity values to be incrmented & set by SQL Server. However there are edge cases where you may need
401+
to explicitly specify the Identity values and have those be set. An example of this may be if data was archived/backed-up elsewhere and
402+
now needs to be restored; it's original Identity value may still be valid and need to be used for referential integrity.
403+
404+
This can now be done by simply specifying `enableIdentityInsert = true` parameter on the Bulk API calls as shown below...
405+
406+
**Warnging:** _It is your responsibility to test and validate your Identity values are valid on the Model; SQL Server may enforce
407+
uniqueness if they are the PKey, etc. however bad data like default int value of Zero, or negative values may be saved with this feature._
408+
409+
```csharp
410+
//Normally would be provided by Dependency Injection...
411+
//This is a DI friendly connection factory/provider pattern that can be used...
412+
ISqlBulkHelpersConnectionProvider sqlConnectionProvider = new SqlBulkHelpersConnectionProvider(sqlConnectionString);
413+
414+
using (var sqlConnection = await sqlConnectionProvider.NewConnectionAsync())
415+
using (SqlTransaction sqlTransaction = (SqlTransaction)await sqlConnection.BeginTransactionAsync())
416+
{
417+
//Will send the actual value of Identity ID property to be stored in the Database because enableIdentityInsert is true!
418+
var results = await sqlTransaction.BulkInsertOrUpdateAsync(testData, enableIdentityInsert: true);
419+
420+
//Don't forget to commit the changes...
421+
await sqlTransaction.CommitAsync();
422+
}
423+
424+
```
425+
392426
### Clearing Tables (Truncate even when you have FKey constraints!)
393427
Normally if your table has FKey constraints you cannot Truncate it... by leveraging the materialized data api we can efficiently clear
394428
the table even with these constraints by simply switching it out for an empty table! And, this is still fully transactionally safe!
@@ -461,6 +495,36 @@ NOTE: These methods can also be used with data models that have mapped table nam
461495

462496
_**NOTE: More Sample code is provided in the Sample App and in the Tests Project Integration Tests...**__
463497

498+
### Retrieve & Set the Current Identity ID Valud (Seed value)...
499+
For edge cases it may be very helpful to both retrieve and/or set/re-seed the current Identity Value of a table. This can be done
500+
easily with the helper apis as shown:
501+
502+
```csharp
503+
//Normally would be provided by Dependency Injection...
504+
//This is a DI friendly connection factory/provider pattern that can be used...
505+
ISqlBulkHelpersConnectionProvider sqlConnectionProvider = new SqlBulkHelpersConnectionProvider(sqlConnectionString);
506+
507+
using (var sqlConnection = await sqlConnectionProvider.NewConnectionAsync())
508+
using (SqlTransaction sqlTransaction = (SqlTransaction)await sqlConnection.BeginTransactionAsync())
509+
{
510+
//Clear the table and force bypassing of constraints...
511+
var currentIdentityValue = await sqlTrans.GetTableCurrentIdentityValueAsync("Table1");
512+
513+
//OR using Model with Table Mapping Annotations...
514+
var currentIdentityValueForModel = await sqlTrans.GetTableCurrentIdentityValueAsync<Table1Model>();
515+
516+
//Now we can explicitly re-seed the value in Sql Server similarly...
517+
int newIdentitySeedValue = 12345;
518+
await sqlTrans.ReSeedTableIdentityValueAsync("Table1", newIdentitySeedValue);
519+
520+
//OR similarly using a Model with Table Mapping Annotations...
521+
await sqlTrans.ReSeedTableIdentityValueAsync<Table1Model>(newIdentitySeedValue);
522+
523+
//Don't forgot to commit the changes!
524+
await sqlTransaction.CommitAsync();
525+
}
526+
```
527+
464528
## Prior Release Notes
465529

466530
### v1.4 Release Notes:

0 commit comments

Comments
 (0)