A lightweight, high-performance .NET infrastructure framework designed to eliminate boilerplate code. SadLib provides clean abstractions for object mapping, database operations, file upload and management.
- Contract-Based Mapping: Fast object-to-object mapping using marker interfaces.
- Managed Data Access: Simplified Dapper-friendly
IDbClientwith automatic connection and transaction management. - Flexible Storage: Abstraction for local or cloud file storage.
- Secure Uploads: Integrated file type validation and image processing pipeline.
- Pagination: Standardized
IPagedResultfor consistent API responses.
dotnet add package SadLibTo enable SadLib features, register the services in your Program.cs (or Startup.cs) using the fluent configuration API:
using SadLib.Infrastructure.DependencyInjection;
using SadLib.Infrastructure.Storage.Providers;
var builder = WebApplication.CreateBuilder(args);
// Add SadLib Services
builder.Services.AddSadLib(options =>
{
options
.UseMapper(System.Reflection.Assembly.GetExecutingAssembly(), $"{nameof(YourProjectName)}.Models")
.UseStorage(new PhysicalStorageProviderFactory(builder.Environment.WebRootPath))
.UseDbService(Microsoft.Data.SqlClient.SqlClientFactory.Instance)
.UseUpload();
});
var app = builder.Build();To see SadLib in action within a real-world scenario, check out our comprehensive demo application. It demonstrates full-stack integration, including RBAC, advanced file management, and repository patterns.