Using Both (Extend & Override)

You’re not limited to just one approach—you can combine overriding existing methods and adding new ones in a single custom Unit of Work class.

This gives you maximum flexibility:

  • Override methods to change or enhance built-in data/transaction behavior.

  • Extend by introducing brand new methods tailored to your project’s needs.

For example, you might override SaveChangesAsync to add auditing, while also introducing a new utility method like ClearAllTables.

This is the true power of REN.Kit’s design: your Unit of Work can be as standard or as custom as you need.

circle-check

Pro Tip:


How to Use Both? (Override + Extend)

1. Create a New Interface for Your Custom Methods

public interface IExtendedRENUnitOfWork<TDbContext> : IRENUnitOfWork<TDbContext>
    where TDbContext : DbContext
{
    void AdditionalMethod();
}

This interface introduces your new method(s) while keeping all defaults.


2. Implement Your Custom Unit of Work


3. Register Your Custom Implementation

Since you’re introducing a new interface and class, register both:

The registration method (for reference):


4. Use Your Custom Unit of Work in Action

circle-check

Pro Tip:

And you're good to go!

With this approach, your Unit of Work becomes a tailored orchestration layer perfectly suited to your app’s evolving requirements.

Last updated