MVFC.DataX.Providers.SqlServer
1.2.0
dotnet add package MVFC.DataX.Providers.SqlServer --version 1.2.0
NuGet\Install-Package MVFC.DataX.Providers.SqlServer -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MVFC.DataX.Providers.SqlServer" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVFC.DataX.Providers.SqlServer" Version="1.2.0" />
<PackageReference Include="MVFC.DataX.Providers.SqlServer" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MVFC.DataX.Providers.SqlServer --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MVFC.DataX.Providers.SqlServer, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MVFC.DataX.Providers.SqlServer@1.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MVFC.DataX.Providers.SqlServer&version=1.2.0
#tool nuget:?package=MVFC.DataX.Providers.SqlServer&version=1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MVFC.DataX.Providers.SqlServer
SQL Server (MSSQL) data provider for MVFC.DataX, implementing readers and writers using Microsoft.Data.SqlClient.
This package is part of the MVFC.DataX suite. For the full documentation and more examples, please check the main repository README.
Installation
dotnet add package MVFC.DataX.Providers.SqlServer
Available Classes
| Class | Description |
|---|---|
SqlServerDataReader<T> |
Reads data from SQL Server utilizing SqlDataReader via a user-defined mapping function. |
SqlServerDataWriter<T> |
Writes data to SQL Server using parameterized queries. Supports batch transactions with commit and automatic rollback. |
API Signatures
SqlServerDataReader<T>
public SqlServerDataReader(
string connectionString,
string query,
Func<SqlDataReader, T> mapper,
Action<SqlCommand>? configureCommand = null)
SqlServerDataWriter<T>
public SqlServerDataWriter(
string connectionString,
string commandText,
Action<SqlCommand, T> bindParameters)
Usage / Example
using MVFC.DataX.Pipeline;
using MVFC.DataX.Providers.SqlServer;
using Microsoft.Data.SqlClient;
var connectionString = "Server=localhost;Database=testdb;User Id=sa;Password=test;";
// 1. Setup the SQL Server Reader
var reader = new SqlServerDataReader<User>(
connectionString,
"SELECT Id, Name, Email FROM Users WHERE IsActive = 1",
// Map the SqlDataReader into your C# object
mapper: r => new User
{
Id = r.GetInt32(0),
Name = r.GetString(1),
Email = r.GetString(2)
}
);
// 2. Setup the SQL Server Writer
var writer = new SqlServerDataWriter<User>(
connectionString,
"INSERT INTO ImportedUsers (OriginalId, Name, Email) VALUES (@Id, @Name, @Email)",
// Bind your C# object's properties to the SqlCommand parameters
bindParameters: (command, user) =>
{
command.Parameters.AddWithValue("@Id", user.Id);
command.Parameters.AddWithValue("@Name", user.Name);
command.Parameters.AddWithValue("@Email", user.Email);
}
);
// 3. Orchestrate with PipelineBuilder
var pipeline = PipelineBuilder.ReadFrom(reader)
.WriteTo(writer)
.WithBatchSize(100) // Writes will be grouped into transactions
.Build();
await pipeline.RunAsync(cancellationToken);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.Data.SqlClient (>= 6.0.1)
- MVFC.DataX.Core (>= 1.2.0)
-
net9.0
- Microsoft.Data.SqlClient (>= 6.0.1)
- MVFC.DataX.Core (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.