-
-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
agile.zhou
committed
Jan 6, 2024
1 parent
7b453e5
commit 7057e50
Showing
9 changed files
with
116 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AgileConfig.Server.Data.Abstraction | ||
{ | ||
public interface IUow : IDisposable | ||
{ | ||
Task<bool> SaveChangesAsync(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using FreeSql; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AgileConfig.Server.Data.Freesql | ||
{ | ||
public class FreeSqlUow : Abstraction.IUow | ||
{ | ||
private readonly IFreeSql _freeSql; | ||
private IUnitOfWork _unitOfWork; | ||
|
||
|
||
public FreeSqlUow(IFreeSql freeSql) | ||
{ | ||
this._freeSql = freeSql; | ||
_unitOfWork = _freeSql.CreateUnitOfWork(); | ||
} | ||
|
||
public IUnitOfWork GetFreesqlUnitOfWork() | ||
{ | ||
return _unitOfWork; | ||
} | ||
|
||
public Task<bool> SaveChangesAsync() | ||
{ | ||
_unitOfWork.Commit(); | ||
|
||
return Task.FromResult(true); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_unitOfWork?.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters