AsNet.Shared.Data
2.3.0.1
dotnet add package AsNet.Shared.Data --version 2.3.0.1
NuGet\Install-Package AsNet.Shared.Data -Version 2.3.0.1
<PackageReference Include="AsNet.Shared.Data" Version="2.3.0.1" />
<PackageVersion Include="AsNet.Shared.Data" Version="2.3.0.1" />
<PackageReference Include="AsNet.Shared.Data" />
paket add AsNet.Shared.Data --version 2.3.0.1
#r "nuget: AsNet.Shared.Data, 2.3.0.1"
#:package AsNet.Shared.Data@2.3.0.1
#addin nuget:?package=AsNet.Shared.Data&version=2.3.0.1
#tool nuget:?package=AsNet.Shared.Data&version=2.3.0.1
AsNet.Shared.Data
Enterprise‑grade, multi‑tenant data infrastructure library for .NET that provides dynamic connection string resolution, secure integration with AsNetSecurity and IdentityServer, and a complete generic data access framework built on Entity Framework Core.
Overview
AsNet.Shared.Data is a shared data infrastructure framework designed for enterprise and multi‑tenant applications.
It centralizes connection string resolution, security‑aware data access, and provides generic, reusable data access components for both Entity‑first and DTO‑first architectures.
The library integrates directly with AsNetSecurity (V1 and V2) and IdentityServer (OAuth2 / OpenID Connect) to securely resolve tenant‑specific connection strings and initialize safe, isolated DbContext instances per tenant.
Key Features
- ✅ Multi‑tenant architecture with dynamic connection string resolution.
- ✅ Integration with AsNetSecurity V1 / V2.
- ✅ Secure access using OAuth2 / IdentityServer.
- ✅ Centralized tenant initialization via
BaseApplication. - ✅ Generic Entity‑first repositories (queries & commands).
- ✅ Generic DTO‑first repositories using AutoMapper.
- ✅ Support for streaming queries with
IAsyncEnumerable<T>. - ✅ Rich stored procedure support (OUTPUT & RETURN values).
- ✅ Transaction management.
- ✅ Standardized result contracts (
DmlResult,BResult). - ✅ Built‑in auditing support.
- ✅ Contextual logging by Tenant, Entity, DTO, and Host.
- ✅ Configuration‑driven behavior via
appsettings.json. - ✅ Multi‑framework support.
Supported Frameworks
- .NET Standard 2.1
- .NET 8.0
- .NET 9.0
- .NET 10.0
Architecture Overview
The package is structured in three clear layers:
1️⃣ Infrastructure Layer
- Dynamic tenant connection resolution
- Security integration
- DbContext initialization
Core components:
ApplicationSettingsConnectionStringServiceSecuritySourceEnumBaseApplication<TDbContext>
2️⃣ Persistence Layer (Entity‑First)
Generic repositories built directly on Entity Framework Core.
Queries
GenericQueries<TEntity, TContext>
Supports:
- Filters, ordering, includes
- Projections
- Streaming queries
- Raw SQL & stored procedures
- StandardList builders
Commands
GenericCommands<TEntity, TContext>GenericCommandsDml<TEntity, TContext>
Supports:
- CRUD & bulk operations
- Transactions
- Stored procedures
- Typed primary key retrieval
DmlResultstandardized responses
3️⃣ Application Layer (DTO‑First)
Designed for Application Services and APIs.
Queries
GenericQueriesB<TDto, TEntity, TContext>GenericQueriesBResult<TDto, TEntity, TContext>
Features:
- DTO‑first querying
- Expression mapping (AutoMapper)
- Streaming
BResultstandardized responses
Commands
GenericCommandsB<TDto, TEntity, TContext>GenericCommandsBResult<TDto, TEntity, TContext>
Features:
- DTO‑first commands
- Validation & existence checks
- Optional auditing (
IAuditable<TAudit>) - Transaction support
BResultfor API‑friendly responses
Security & Multi‑Tenant Support
Supported Connection Sources
Connection strings can be resolved from:
- AppSettings
- AsNetSecurity V1
- AsNetSecurity V2
Selection is controlled via SecuritySourceEnum and configuration defaults.
Required Configuration
"AsNet": {
"Security": {
"ApplicationSettings": {
"CommandTimeout": 301,
"ConnectionProviderName": "Microsoft.Data.SqlClient",
"ApplicationId": "<application-id>",
"ApplicationName": "<application-name>",
"ApplicationSalt": "<application-salt>",
"ConnectionType": "Production",
"SecurityWebApi": "https://your-security-api",
"DefaultLocalConnectionName": "DefaultConnection",
"DBContextLogger": false,
"DefaultSecuritySource": "AppSettings"
},
"IdentityServerSettings": {
"Address": "https://your-identityserver",
"ClientId": "<client-id>",
"ClientSecret": "<client-secret>",
"Scope": "<scope>"
}
}
}
| Product | Versions 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. |
-
net10.0
- AsNet.Shared.Http (>= 1.2.0.3)
- AutoMapper.Extensions.ExpressionMapping (>= 11.0.0)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Microsoft.EntityFrameworkCore (>= 10.0.5)
- Microsoft.EntityFrameworkCore.SqlServer (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
-
net8.0
- AsNet.Shared.Http (>= 1.2.0.3)
- AutoMapper.Extensions.ExpressionMapping (>= 11.0.0)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.14)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
-
net9.0
- AsNet.Shared.Http (>= 1.2.0.3)
- AutoMapper.Extensions.ExpressionMapping (>= 11.0.0)
- Duende.IdentityModel (>= 8.1.0)
- Microsoft.Data.SqlClient (>= 7.0.0)
- Microsoft.EntityFrameworkCore (>= 9.0.14)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
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 | |
|---|---|---|---|
| 2.3.0.1 | 36 | 4/8/2026 | |
| 2.3.0 | 86 | 4/6/2026 | |
| 2.2.2 | 89 | 3/26/2026 | |
| 2.2.1.1 | 118 | 2/9/2026 | |
| 2.2.1 | 129 | 1/14/2026 | |
| 2.2.0 | 112 | 1/13/2026 | |
| 2.1.1.6 | 248 | 6/30/2025 | |
| 2.1.1.5 | 232 | 1/6/2025 | |
| 2.1.1.4 | 205 | 12/9/2024 | |
| 2.1.1.3 | 216 | 12/9/2024 | |
| 2.1.1.2 | 238 | 11/11/2024 | |
| 2.1.1.1 | 243 | 9/6/2024 | |
| 2.1.1 | 238 | 6/9/2024 | |
| 2.1.0.8 | 248 | 5/29/2024 | |
| 2.1.0.7 | 277 | 4/1/2024 | |
| 2.1.0.6 | 232 | 3/30/2024 | |
| 2.1.0.5 | 274 | 9/29/2023 | |
| 2.1.0.4 | 213 | 9/28/2023 | |
| 2.1.0.3 | 251 | 9/2/2023 | |
| 2.1.0.2 | 289 | 6/15/2023 |
• Designed for .NET 8.0, .NET 9.0, and .NET 10.0.
• Introduces a complete multi‑tenant data infrastructure built on Entity Framework Core.
• Adds dynamic connection string resolution per tenant with AsNetSecurity V1 and V2 integration.
• Includes generic Entity‑first repositories for queries and commands.
• Adds DTO‑first repositories using AutoMapper for application and API layers.
• Supports streaming data access using IAsyncEnumerable<T>.
• Includes standardized result contracts (DmlResult and BResult).
• Adds built‑in support for stored procedures with OUTPUT and RETURN values.
• Provides transaction management and optional auditing support.
• Improves contextual logging with tenant, entity, DTO, and host metadata.