IUnitOfWorkVH 10.0.0

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

IUnitOfWorkVH

Description

Define application or class library, which will extend the base of the implemented Unit of Work pattern.

  • Include to the project NuGetPackage: IUnitOfWorkVH latest version

Usage

  1. Define application DB context definition base on DbContext
using IUnitOfWorkVH;
using Microsoft.EntityFrameworkCore;

public class ApplicationDbContext : DbContext
{
    // Define your DbSets here
    public DbSet<YourEntity1> YourEntities1 { get; set; }
    public DbSet<YourEntity2> YourEntities2 { get; set; }

    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options) { }
}
  1. Create files with interfaces and repositories base on your entities
using IUnitOfWorkVH;

/// this repository will have only Get method - perfect for classifiers
public interface IRepYourEntity1 : IRepBase<YourEntity1>
{
    // Define additional methods if needed
}

/// this repository will have Get/Add/Remove methods - for general purpose entities
public interface IRepYourEntity2 : IRep<YourEntity2>
{
    // Define additional methods if needed
}

///.....

public class RepYourEntity1(ApplicationDbContext context) : RepBase<ApplicationDbContext, YourEntity1>(context), IRepYourEntity1
public class RepYourEntity2(ApplicationDbContext context) : RepBase<ApplicationDbContext, YourEntity2>(context), IRepYourEntity2
  1. Define local interface IUnitOfWork and inherit from the IUnitOfWorkBase interface
using IUnitOfWorkVH;
public interface IUnitOfWork : IUnitOfWorkBase<ApplicationDbContext>
{
    // Define additional methods or properties if needed
    IRepYourEntity1 YourEntityRep1 { get; }
    IRepYourEntity2 YourEntityRep2 { get; }
}
  1. Create class UnitOfWork and inherit from the UnitOfWorkAbstract class and your local IUnitOfWork interface

Dont forget initialize base._ctx [Required] and base._logger [Optional] in the constructor

public class UnitOfWork : UnitOfWorkAbstract<ApplicationDbContext>
{
    public UnitOfWork(ApplicationDbContext context, ILogger<ApplicationDbContext> logger) : base(context)
    {
        /// Required initializations
        this._logger = logger;
        this._ctx = context;

        // Initialize your repositories here
        YourEntityRep1 = new RepYourEntity1(context);
        YourEntityRep2 = new RepYourEntity2(context);
    }

    // Implement additional methods or properties if needed
    // Define additional methods or properties if needed
    IRepYourEntity1 YourEntityRep1 { get; }
    IRepYourEntity2 YourEntityRep2 { get; }
}

Don't forget to register the UnitOfWork class in the DI container of your application.

Product Compatible and additional computed target framework versions.
.NET 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
10.0.0 258 11/14/2025
1.0.2 199 10/27/2025
1.0.1 162 10/26/2025