This repository was archived by the owner on Apr 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 33 <PropertyGroup >
44 <TargetFramework >netstandard2.0</TargetFramework >
55 <PackageId >Nodes.NetCore.EntityFramework.Helpers</PackageId >
6- <Version >0.1.0 </Version >
6+ <Version >0.1.1 </Version >
77 <Authors >Nodes</Authors >
88 <Company >Nodes</Company >
99 <Product >.NET Core Entity Framework Helpers</Product >
Original file line number Diff line number Diff line change 55
66namespace Nodes . NetCore . EntityFramework . Repositories
77{
8- public abstract class EntityRepository < T > where T : EntityBase
8+ public abstract class EntityRepository < T , TContext > : IDisposable where T : EntityBase where TContext : DbContext
99 {
1010 protected DbSet < T > Table { get ; private set ; }
11+ private TContext Context { get ; set ; }
1112
12- protected EntityRepository ( DbSet < T > table )
13+ protected EntityRepository ( TContext context , DbSet < T > table )
1314 {
15+ Context = context ;
1416 Table = table ;
1517 }
1618
1719 public async Task < T > Get ( Guid id )
1820 {
1921 return await Table . FirstOrDefaultAsync ( entity => ! entity . Deleted && entity . Id == id ) ;
2022 }
23+
24+ public void Dispose ( )
25+ {
26+ Context . SaveChanges ( ) ;
27+ }
2128 }
2229}
You can’t perform that action at this time.
0 commit comments