Zongsoft.Data.MsSql 7.17.0

dotnet add package Zongsoft.Data.MsSql --version 7.17.0
                    
NuGet\Install-Package Zongsoft.Data.MsSql -Version 7.17.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="Zongsoft.Data.MsSql" Version="7.17.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zongsoft.Data.MsSql" Version="7.17.0" />
                    
Directory.Packages.props
<PackageReference Include="Zongsoft.Data.MsSql" />
                    
Project file
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 Zongsoft.Data.MsSql --version 7.17.0
                    
#r "nuget: Zongsoft.Data.MsSql, 7.17.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 Zongsoft.Data.MsSql@7.17.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=Zongsoft.Data.MsSql&version=7.17.0
                    
Install as a Cake Addin
#tool nuget:?package=Zongsoft.Data.MsSql&version=7.17.0
                    
Install as a Cake Tool

Zongsoft.Data.MsSql Data Driver Plugin Library

License NuGet Version NuGet Downloads GitHub Stars

English | 简体中文


Overview

Zongsoft.Data.MsSql is a low-level data engine driver in the Zongsoft open-source framework. It provides access to Microsoft SQL Server and is transparent to upper-layer applications; deploy this plugin library to the application plugin directory to enable it.

When to Use This Driver

Choose this package when a Zongsoft data model is stored in Microsoft SQL Server. The public application contract remains IDataAccess/IDataService<T>; this package translates expressions and mutations into the database dialect and creates connections through Microsoft.Data.SqlClient.

SQL Server quoting, identity retrieval, paging, parameters, and bulk import are emitted by this dialect. Server permissions and transaction isolation remain deployment concerns.

Installation and Plugin Deployment

dotnet add package Zongsoft.Data.MsSql

Deploy Zongsoft.Data.MsSql.plugin with the assembly. Its manifest registers the connection-settings parser and data driver under the framework workbench. A NuGet reference without the plugin manifest does not activate the driver in a plugin host.

Connection Configuration

<options>
	<option path="/Data">
		<connectionSettings default="Application">
			<connectionSetting connectionSetting.name="Application"
			                   driver="MsSql"
			                   value="Server=localhost;Database=docs;IntegratedSecurity=true" />
		</connectionSettings>
	</option>
</options>

The driver value is case-insensitive but should use the canonical MsSql spelling. The value follows the Core settings contract: it contains explicit driver parameters and extension properties. GetOptions() maps driver parameters to the native options consumed by Microsoft.Data.SqlClient; extension properties remain in the framework settings and its complete Value. For native provider capabilities, consult the provider documentation for supported keywords.

💡 Keep entity mappings, criteria, paging, transactions, and IDataAccess usage in the shared Zongsoft.Data guide. Switching drivers should not require application services to depend on provider connection classes.

The connection string uses this driver's public settings model, which does not necessarily expose every underlying SDK keyword. Examples target local test environments only. Prepare databases, accounts and permissions, and replace explicitly marked test credentials; this is not a server initialization script.

Access Through Application Contracts

The consumer module references Core; the host deploys Data and this driver. After startup, obtain the accessor matching the configured connection name:

using Zongsoft.Data;
using Zongsoft.Services;

var provider = ApplicationContext.Current.Services
	.ResolveRequired<Zongsoft.Services.IServiceProvider<IDataAccess>>();
var data = provider.GetService("Application")
	?? throw new InvalidOperationException("Data accessor not found.");
Console.WriteLine(data.Name);

See the Data plugin example for host configuration and named accessors. Prepare tables and field types for the selected database, and use the operations supported by this driver. Application services access data through the public contracts.

Runtime Behavior

This driver enables Multiple Active Result Sets (MARS) by default, allowing multiple active readers to share one session connection. Set MultipleActiveResultSets=False to disable it; additional readers then use independent connections while another reader remains active. Connection sharing follows each data source's effective connection settings.

Use the asynchronous methods on IDataAccess / IDataService<T> and consume query results with await foreach. Await transaction completion, rollback, and resource disposal. Imports accept in-memory collections and asynchronous sources, and operations propagate cancellation tokens.

Imports prepare and write batches of at most 1024 rows, enumerating the input once. By default, batches share the session transaction. Without an ambient transaction, the operation commits after all batches succeed and rolls back its transaction on failure or cancellation. With an ambient transaction, the caller controls completion. When ambient transaction enlistment is explicitly suppressed, completed batches are unaffected by the caller's rollback and may remain after later input or write failures.

🚨 Never commit production connection strings. Use deployment-time configuration or a secret provider, grant the database identity only the required permissions, and verify destructive mutations against a disposable database first.

Compatibility and Testing

Database behavior is not completely portable. Verify identifier casing, null and comparison rules, date/time precision, generated values, transaction semantics, and bulk-import constraints on the same server/provider versions used in production. Repository tests require an explicitly configured disposable database and are not ordinary offline unit tests.

Plugin-Based Integration

Compose this feature through the host; a package reference supplies compile-time APIs, while plugin loading also requires deployed manifests and runtime assets. See the complete plugin workflow.

The manifest adds the driver to /Workbench/Data/Drivers and the connection-settings registry. Configure the exact driver key shown above, deploy the application's mapping, then obtain IDataAccess from the host. Database creation/migration remains an explicit application operation.

Runtime artifact Source of truth
Zongsoft.Data.MsSql Zongsoft.Data.MsSql.plugin
File copying and dependencies Zongsoft.Data.MsSql.deploy

Add this fragment to an existing host .deploy (retain Main and the host’s other base manifests; do not replace the whole file):

[plugins zongsoft data]
nuget:Zongsoft.Data

[plugins zongsoft data mssql]
nuget:Zongsoft.Data.MsSql

Run dotnet deploy against a test deployment as explained in the workflow, with the host's framework, platform, architecture and, where needed, site. Pin compatible versions in real deployments; application dependencies such as databases, caches or commercial runtimes are still separate prerequisites.

Additional artifacts listed by the deployment manifest include Zongsoft.Data.MsSql.plugin. Retain assemblies, dependencies and satellite resource directories as well. Restart the host after deployment, check plugin loading and service/driver registration, then verify the workflow above; copied files alone do not prove that the feature is active.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
7.17.0 107 10/25/2026
7.16.0 96 10/24/2026
7.15.0 98 10/24/2026
7.14.0 98 10/22/2026
7.13.0 101 10/22/2026
7.12.0 109 10/16/2026
7.11.0 115 10/10/2026
7.10.0 124 9/18/2026
7.9.0 150 8/11/2026
7.8.0 150 7/30/2026
7.7.2 143 7/28/2026
7.7.1 162 4/10/2026
7.7.0 165 3/12/2026
7.6.0 163 2/11/2026
7.5.0 168 1/22/2026
7.4.0 178 1/8/2026
7.3.0 393 11/12/2025
7.2.0 303 9/23/2025
7.1.0 293 6/23/2025
7.0.0 286 2/24/2025
Loading failed

使用类型化特性提供返回值能力,并按数据源配置判断连接共享。