Using Both
Implementing Additional Methods
public interface IMyUnitOfWork<TDbContext>: IRENUnitOfWork<TDbContext> where TDbContext : RENDbContext
{
Task MyCustomFunction(CancellationToken cancellationToken = default);
}public class MyUnitOfWork<TDbContext> : RENUnitOfWork<TDbContext>, IMyUnitOfWork<TDbContext> where TDbContext : RENDbContext
{
public MyUnitOfWork(TDbContext context) : base(context) { }
public Task MyCustomFunction(CancellationToken cancellationToken = default)
{
return Task.Factory.StartNew(() =>
{
cancellationToken.ThrowIfCancellationRequested();
Console.WriteLine("This is my custom Function");
// other custom implementations!
}, cancellationToken);
}
public override Task<bool> SaveChangesAsync()
{
Console.WriteLine("This is my custom SaveChangesAsync");
return base.SaveChangesAsync();
}
}Last updated