A collection of reusable utility libraries for .NET, published as individual NuGet packages. Each package targets a specific concern — from core extensions and domain primitives to data access, dependency injection, MediatR pipelines, ASP.NET Core helpers, and WPF utilities — so you can pull in only what you need.
- .NET 10 SDK (for
net10.0targets) - .NET 9 SDK (for
net9.0targets) - .NET 8 SDK (for
net8.0targets) - .NET Standard 2.0 / 2.1 targets are compatible with .NET Framework 4.6.1+ and .NET Core 2.0+
Install any package via the NuGet Package Manager, the .NET CLI, or by editing your project file.
.NET CLI
dotnet add package SharedCode.Core
dotnet add package SharedCode.Data
dotnet add package SharedCode.Data.CosmosDb
dotnet add package SharedCode.Data.EntityFramework
dotnet add package SharedCode.DependencyInjection
dotnet add package SharedCode.MediatR
dotnet add package SharedCode.Web
dotnet add package SharedCode.Windows.WPFPackage Manager Console
Install-Package SharedCode.Core
Install-Package SharedCode.Data
Install-Package SharedCode.Data.CosmosDb
Install-Package SharedCode.Data.EntityFramework
Install-Package SharedCode.DependencyInjection
Install-Package SharedCode.MediatR
Install-Package SharedCode.Web
Install-Package SharedCode.Windows.WPFCore utilities and domain primitives that are shared across all other packages. Targets
netstandard2.0, netstandard2.1, net8.0, net9.0, and net10.0.
Highlights
- Extension methods —
DateTime,DateTimeOffset,string,int,Enum, collections,Type,IEnumerable, reflection, and more - Specification pattern — strongly typed
Specification<T>/Specification<T, TResult>with a fluent query builder (filter, ordering, paging, includes) - Domain primitives —
ValueObject,BaseException, result types (IResult,IErrorResult,ValidationErrorResult) - Security —
Hasherutility supporting multiple hash algorithms - Text —
StringExtensions,StringBuilderExtensions, masking helpers - Calendar — business-day arithmetic,
DateTimeFormat,DayOfWeekExtensions - Reactive — built on
System.ReactiveandSystem.Interactive - Threading — async-friendly utilities
Quick Start
// Add business daysvarnextBusinessDay=DateTime.Today.AddBusinessDays(3);// Specification patternpublicsealedclassActiveUsersSpec:Specification<User>{publicActiveUsersSpec()=>this.Query.Where(u =>u.IsActive).OrderBy(u =>u.LastName);}Framework-agnostic data access abstractions. Targets netstandard2.0, netstandard2.1,
net8.0, net9.0, and net10.0.
Highlights
IQueryRepository<T>/ICommandRepository<T>contractsQueryRepository<T>— default generic / in-memory implementationIQueryResult<T>with paging support viaPagingDescriptorandPageBoundryAddOrUpdatedescriptor patternDataReaderExtensions,DynamicDataRecord, and ODataDataServiceQueryExtensions
Quick Start
publicclassUserService{privatereadonlyIQueryRepository<User>repository;publicUserService(IQueryRepository<User>repository)=>this.repository=repository;publicasyncTask<IQueryResult<User>>GetActiveUsersAsync(CancellationTokenct)=>awaitthis.repository.ListAsync(newActiveUsersSpec(),ct);}Azure Cosmos DB integration built on top of the official
Microsoft.Azure.Cosmos SDK.
Targets net8.0, net9.0, and net10.0.
Highlights
- Cosmos DB query helpers and logger extensions
Query<T>helper for building Cosmos DB LINQ queries
Entity Framework Core integration. Targets net8.0, net9.0, and net10.0.
Highlights
AuditableDbContext— automatically stampsCreatedAt/ModifiedAtonIAuditableEntityEfRepository<T>— EF Core implementation ofIQueryRepository<T>andICommandRepository<T>Entitybase class andIAuditableEntity/IAuditedEntityinterfaces- Specification evaluator wired directly into EF Core queries
IDataService/DataServicefor unit-of-work style operations
Quick Start
// Register with resilient SQL Server connectionservices.AddDbContext<AppDbContext>(options =>options.UseSqlServer(connectionString,
sqlOptions =>sqlOptions.EnableRetryOnFailure(maxRetryCount:10,maxRetryDelay:TimeSpan.FromSeconds(30),errorNumbersToAdd:null)));Assembly scanning and automatic service registration. Targets netstandard2.0,
netstandard2.1, net8.0, net9.0, and net10.0.
Highlights
IDependencyRegister— implement on any class to self-register servicesDependencyLoader— scans assemblies and invokes allIDependencyRegisterimplementationsCatalogSelector/TypeSourceSelectorfor fine-grained assembly and type filtering
Quick Start
// In Startup.cs / Program.csservices.LoadDependencies(typeof(Program).Assembly);// In any librarypublicclassMyServiceRegistrar:IDependencyRegister{publicvoidRegister(IServiceCollectionservices)=>services.AddScoped<IMyService,MyService>();}MediatR pipeline abstractions. Targets net8.0,
net9.0, and net10.0.
Highlights
ICommand/ICommand<TResponse>— strongly typed command markersICommandHandler/ICommandHandler<TCommand, TResponse>— handler contractsIQuery<TResponse>/IQueryHandler<TQuery, TResponse>— query/response contracts- Extension method for registering MediatR from an assembly
Quick Start
// Define a commandpublicsealedrecordCreateUserCommand(stringName):ICommand<Guid>;// Implement a handlerpublicsealedclassCreateUserCommandHandler:ICommandHandler<CreateUserCommand,Guid>{publicasyncTask<Guid>Handle(CreateUserCommandrequest,CancellationTokenct){// create user ...returnnewUser.Id;}}// Register in Program.csservices.AddSharedCodeMediatR(typeof(Program).Assembly);ASP.NET Core helpers. Targets net9.0 and net10.0.
Highlights
BaseController— abstract controller base that exposes anIHttpClientFactory- Service collection extensions for resilient HTTP clients (Polly retry/wait)
- Health check registration helpers
Quick Start
[ApiController][Route("api/[controller]")]publicclassUsersController:BaseController{publicUsersController(IHttpClientFactoryhttpClientFactory):base(httpClientFactory){}}WPF helpers targeting net9.0-windows10.0.22621.0 and net10.0-windows10.0.22621.0.
Highlights
BindableBase— base class implementingINotifyPropertyChanged- Value converters —
BooleanToVisibilityConverter,StringToVisibilityConverter,NumberToStringConverter PasswordHelper— attached property for bindingPasswordBox.PasswordMediator— simple in-process message broker for loosely coupled view-modelsModalTemplateAttribute— data-template helper for modal view-models
Note: The WPF community has excellent implementations of commands and more in the CommunityToolkit.Mvvm package. That package is referenced as a dependency and its commands are the recommended approach.
# Clone the repository
git clone https://github.com/improvgroup/sharedcode.git
cd sharedcode
# Restore and build
dotnet build SharedCode.sln
# Run all tests
dotnet test SharedCode.slnThe solution targets .NET 8, .NET 9, and .NET 10 for library projects (plus .NET Standard 2.0/2.1 compatibility for selected packages). The WPF project additionally requires Windows 10 SDK version 10.0.19041.0 or later.
Contributions are welcome! Please follow these steps:
- Fork the repository and create a feature branch.
- Make your changes, ensuring all existing tests pass (
dotnet test SharedCode.sln). - Add or update tests as appropriate.
- Open a pull request against the
mainbranch.
Please read the Code of Conduct and Security Policy before contributing.
This project is licensed under the MIT License.
Copyright © 2026 improvGroup, LLC and contributors.