12345678910111213141516171819202122232425262728293031323334353637383940 |
- using DW5S.Entity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DW5S.Repostory
- {
- public interface IUnitOfWork : IAsyncDisposable
- {
- IRepository<TEntity> Of<TEntity>() where TEntity : BaseEntity;
- Task<int> SaveAsync();
- }
- public class UnitOfWork : IUnitOfWork
- {
- private readonly OracleContext ctx;
- public IRepository<TEntity> Of<TEntity>() where TEntity : BaseEntity
- {
- throw new NotImplementedException();
- }
- public UnitOfWork(OracleContext ctx)
- {
- this.ctx = ctx;
- }
- public async Task<int> SaveAsync()
- {
- return await ctx.SaveChangesAsync();
- }
- public async ValueTask DisposeAsync()
- {
- await ctx.DisposeAsync();
- }
- }
- }
|