Acontplus.Persistence.SqlServer
1.5.14
dotnet add package Acontplus.Persistence.SqlServer --version 1.5.14
NuGet\Install-Package Acontplus.Persistence.SqlServer -Version 1.5.14
<PackageReference Include="Acontplus.Persistence.SqlServer" Version="1.5.14" />
<PackageVersion Include="Acontplus.Persistence.SqlServer" Version="1.5.14" />
<PackageReference Include="Acontplus.Persistence.SqlServer" />
paket add Acontplus.Persistence.SqlServer --version 1.5.14
#r "nuget: Acontplus.Persistence.SqlServer, 1.5.14"
#:package Acontplus.Persistence.SqlServer@1.5.14
#addin nuget:?package=Acontplus.Persistence.SqlServer&version=1.5.14
#tool nuget:?package=Acontplus.Persistence.SqlServer&version=1.5.14
Acontplus.Persistence.SqlServer
SQL Server implementation of the Acontplus persistence layer. Provides optimized Entity Framework Core integration, ADO.NET repositories, and SQL Server-specific features for high-performance data access.
Note: This package implements the abstractions defined in Acontplus.Persistence.Common. For general persistence patterns and repository interfaces, see the common package.
🚀 SQL Server-Specific Features
- SQL Server Optimization - Query optimizations and connection pooling for SQL Server
- Advanced Error Translation - SQL Server error code mapping to domain exceptions
- Transaction Management - Distributed transactions and savepoints support
- Bulk Operations - SQL Server bulk insert/update capabilities
- Performance Monitoring - Query execution statistics and performance insights
📦 Installation
NuGet Package Manager
Install-Package Acontplus.Persistence.SqlServer
.NET CLI
dotnet add package Acontplus.Persistence.SqlServer
PackageReference
<ItemGroup>
<PackageReference Include="Acontplus.Persistence.SqlServer" Version="1.5.12" />
<PackageReference Include="Acontplus.Persistence.Common" Version="1.1.13" />
</ItemGroup>
🎯 Quick Start
1. Configure SQL Server Context
services.AddDbContext<BaseContext>(options =>
options.UseSqlServer(connectionString, sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(3, TimeSpan.FromSeconds(30), null);
sqlOptions.CommandTimeout(60);
}));
services.AddScoped(typeof(IRepository<>), typeof(BaseRepository<>));
2. Use Repository Pattern
public class UserService
{
private readonly IRepository<User> _userRepository;
public UserService(IRepository<User> userRepository)
{
_userRepository = userRepository;
}
public async Task<Result<User>> GetUserByIdAsync(int id)
{
var user = await _userRepository.GetByIdAsync(id);
return user != null
? Result<User>.Success(user)
: Result<User>.Failure(DomainError.NotFound("USER_NOT_FOUND", $"User {id} not found"));
}
}
3. Advanced Query Operations
// Complex queries with SQL Server optimizations
public async Task<IReadOnlyList<OrderSummary>> GetOrderSummariesAsync(
DateTime startDate,
CancellationToken ct = default)
{
var queryExpression = (IQueryable<Order> q) => q
.Where(o => o.CreatedAt >= startDate)
.Join(_context.Set<Customer>(),
order => order.CustomerId,
customer => customer.Id,
(order, customer) => new { Order = order, Customer = customer })
.Select(x => new OrderSummary
{
OrderId = x.Order.Id,
CustomerName = $"{x.Customer.FirstName} {x.Customer.LastName}",
TotalAmount = x.Order.TotalAmount,
Status = x.Order.Status
});
return await _orderRepository.ExecuteQueryToListAsync(queryExpression, ct);
}
🔧 SQL Server Configuration
Connection String Best Practices
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=MyApp;Trusted_Connection=True;MultipleActiveResultSets=true;Encrypt=true;TrustServerCertificate=false;"
}
}
Performance Tuning
services.AddDbContext<BaseContext>(options =>
{
options.UseSqlServer(connectionString, sqlOptions =>
{
// Connection resilience
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 5,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null);
// Performance settings
sqlOptions.CommandTimeout(60);
sqlOptions.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
});
// Additional performance options
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
options.EnableSensitiveDataLogging(false);
});
📚 SQL Server API Reference
BaseContext- Optimized EF Core context for SQL ServerAdoRepository- ADO.NET operations with SQL Server-specific error handlingSqlExceptionTranslator- Maps SQL Server error codes to domain exceptionsBulkOperations- High-performance bulk insert/update operationsQueryOptimizer- SQL Server query optimization utilities
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
git clone https://github.com/acontplus/acontplus-dotnet-libs.git
cd acontplus-dotnet-libs
dotnet restore
dotnet build
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🆘 Support
- 📧 Email: proyectos@acontplus.com
- 🐛 Issues: GitHub Issues
- 📖 Documentation: Wiki
👨💻 Author
Ivan Paz - @iferpaz7
🏢 Company
Acontplus - Software solutions
Built with ❤️ for the .NET community
| 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 was computed. 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. |
-
net9.0
- Acontplus.Core (>= 1.5.8)
- Acontplus.Persistence.Common (>= 1.1.15)
- Microsoft.Data.SqlClient (>= 6.1.2)
- Microsoft.EntityFrameworkCore (>= 9.0.10)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.10)
- Microsoft.Extensions.Caching.Memory (>= 9.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.IdentityModel.Tokens (>= 8.14.0)
- Polly (>= 8.6.4)
- System.IdentityModel.Tokens.Jwt (>= 8.14.0)
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 | |
|---|---|---|---|
| 1.5.14 | 150 | 10/23/2025 | |
| 1.5.13 | 151 | 9/26/2025 | |
| 1.5.12 | 166 | 9/25/2025 | |
| 1.5.11 | 159 | 9/24/2025 | |
| 1.5.10 | 217 | 9/14/2025 | |
| 1.5.9 | 218 | 9/14/2025 | |
| 1.5.8 | 218 | 9/14/2025 | |
| 1.5.7 | 170 | 9/10/2025 | |
| 1.5.6 | 167 | 9/9/2025 | |
| 1.5.5 | 203 | 8/24/2025 | |
| 1.5.4 | 156 | 8/21/2025 | |
| 1.5.3 | 158 | 8/19/2025 | |
| 1.5.2 | 161 | 8/8/2025 | |
| 1.5.1 | 223 | 8/8/2025 | |
| 1.5.0 | 240 | 8/7/2025 | |
| 1.4.3 | 239 | 8/6/2025 | |
| 1.4.2 | 246 | 8/5/2025 | |
| 1.4.1 | 124 | 7/31/2025 | |
| 1.4.0 | 544 | 7/23/2025 | |
| 1.3.0 | 553 | 7/18/2025 | |
| 1.2.0 | 176 | 7/14/2025 | |
| 1.1.0 | 163 | 7/14/2025 | |
| 1.0.18 | 112 | 7/11/2025 | |
| 1.0.17 | 107 | 7/11/2025 | |
| 1.0.16 | 170 | 7/10/2025 | |
| 1.0.15 | 167 | 7/10/2025 | |
| 1.0.14 | 155 | 7/10/2025 | |
| 1.0.13 | 168 | 7/9/2025 | |
| 1.0.12 | 187 | 7/9/2025 | |
| 1.0.11 | 356 | 7/6/2025 | |
| 1.0.10 | 349 | 7/6/2025 | |
| 1.0.9 | 382 | 7/4/2025 | |
| 1.0.8 | 165 | 7/2/2025 | |
| 1.0.7 | 166 | 7/2/2025 | |
| 1.0.6 | 155 | 7/2/2025 | |
| 1.0.4 | 513 | 7/1/2025 |
Enhanced with contemporary repository patterns, Entity Framework Core integration, ADO.NET support, advanced error handling, connection resilience with Polly, and enterprise-ready SQL Server data access patterns.