Data MsSql
Overview
VersaTul.Data.MsSql adds SQL Server-specific capabilities on top of Data Sql, including SQL Server parameters, SQL Server data-source types, and a concrete IBulkCopy implementation.
Use it when you want the general service-oriented relational access model from VersaTul.Data.Sql but need SQL Server features such as structured parameters or transactional bulk import.
Why Use This Package
Choose this package when SQL Server is not just one possible provider but an intentional platform choice.
Its strongest adoption value comes from removing the need to build your own SQL Server bulk-copy wrapper and parameter-handling layer.
When To Use This Package
Use this package when you want to:
Target Microsoft SQL Server specifically.
Reuse the
BaseDataServiceworkflow with SQL Server-specific types.Pass SQL Server parameters such as structured values.
Bulk import
IDataReaderdata into SQL Server tables.Validate and upload multiple bulk-copy items in a single transaction.
Installation
Install the package with the .NET CLI:
dotnet add package VersaTul.Data.MsSql
Or with the Package Manager Console:
PM> NuGet\Install-Package VersaTul.Data.MsSql -Version latest
Start Here If
You know SQL Server is the target database.
You need structured parameters, table-valued parameters, or SQL Server bulk import.
Your import workflow already produces
IDataReaderinput and now needs a concrete upload path.
Not The Right First Package If
Database portability still matters.
You only need generic relational reads and writes.
You are still solving file parsing or export generation instead of SQL Server-specific data access.
Works Well With
Data Sql when you want to understand the provider-agnostic base model first.
Data Bulk for shared copy-detail and mapping contracts.
Data FileReader when import files are the source for bulk upload.
File Import Workflow for a full import workflow.
Core Types And Concepts
ISqlDataSourceandSqlDataSourceSQL Server-specialized data source types layered on the generic SQL package.
ISqlParameterandSqlParameterSQL Server-specific parameter types.
IDataConfigurationandDataConfigurationSQL Server configuration types that add
BulkCopyTimeoutto the base SQL configuration surface.BulkCopyConcrete
IBulkCopyimplementation for SQL Server uploads.IBulkCopyServiceand validator/wrapper typesInternal service layer used to validate and execute SQL Server bulk-copy operations.
TableValuedParameterSupport for SQL Server table-valued or structured parameter scenarios.
Key Capabilities
Inherits most relational query and command features from Data Sql.
Supports SQL Server-specific parameters through
SqlParameter.Supports all-or-nothing transactional bulk-copy behavior.
Supports async bulk copy and optional progress callbacks.
Uses
BulkCopyTimeoutfrom configuration during upload operations.
Basic Data-Service Example
using System.Data.Common;
using System.Data.SqlClient;
using VersaTul.Configuration.Defaults.Sql;
using VersaTul.Data.MsSql;
using VersaTul.Data.MsSql.Contracts;
using VersaTul.Data.Sql;
DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
var configSettings = new Builder().AddOrReplace(new[]
{
new KeyValuePair<string, object>(
"AdventureWorks2019",
new ConnectionInfo(
"Server=127.0.0.1;Database=AdventureWorks2019;User Id=sa;Password=Secret;",
"System.Data.SqlClient")),
new KeyValuePair<string, object>("SqlDbConnectionName", "AdventureWorks2019")
}).BuildConfig();
var dataConfiguration = new VersaTul.Data.MsSql.Configurations.DataConfiguration(configSettings);
var providerFactory = new ProviderFactory();
var commandFactory = new CommandFactory(dataConfiguration, providerFactory);
var dataSource = new SqlDataSource(commandFactory);
Bulk Copy Example
The bulk-copy path is the main reason to choose this package over the provider-agnostic SQL package alone.
using VersaTul.Data.Bulk;
using VersaTul.Data.MsSql.Bulk;
var copyDetail = new CopyDetail(
destinationName: "Persons",
reader: peopleReader,
columnMappings: new[]
{
new BulkCopyColumnMapping<Person, Person>(model => model.Name, model => model.Name),
new BulkCopyColumnMapping<Person, Person>(model => model.Age, model => model.Age)
});
var result = await bulkCopy.DoCopyAsync(
new[] { copyDetail },
dBConnectionName: "AdventureWorks2019",
progressCallback: progress => Console.WriteLine($"Processed {progress.ProcessedItems} items"));
Expected Result
When this package is the right fit:
SQL Server-specific requirements stay in one package boundary,
bulk imports use a supported concrete implementation instead of custom upload code, and
application code does not need to reinvent transaction-aware bulk copy.
Next Step
Read File Import Workflow if the next requirement is CSV or text import into SQL Server.
Read Data Bulk if you want deeper mapping-model detail.
Go back to Data Sql if you need to compare the SQL Server-specific path against the provider-agnostic base path.
Notes
If you only need generic relational access, start with Data Sql.
Choose
VersaTul.Data.MsSqlwhen you need SQL Server-specific parameters or bulk import.BulkCopyis designed as an all-or-nothing upload path and will attempt rollback on failure.