-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from Ali-YousefiTelori/develop
Add support for Widget, Reporting Widget only for add #157
- Loading branch information
Showing
36 changed files
with
541 additions
and
23 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<TargetFrameworks>netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks> | ||
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<Version>0.0.1.50</Version> | ||
<Version>0.0.1.51</Version> | ||
<Description>asp core servces.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>core,cores,base,database,services,asp,aspnet</PackageTags> | ||
|
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks> | ||
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<Version>0.0.1.50</Version> | ||
<Version>0.0.1.51</Version> | ||
<Description>asp core servces.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>core,cores,base,database,services,asp,aspnet,aspcore,efcore</PackageTags> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks> | ||
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<Version>0.0.1.50</Version> | ||
<Version>0.0.1.51</Version> | ||
<Description>core of database.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>core,cores,base,client,clients</PackageTags> | ||
|
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<TargetFrameworks>netstandard2.0;netstandard2.1;net45;net6.0;net8.0</TargetFrameworks> | ||
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<Version>0.0.1.50</Version> | ||
<Version>0.0.1.51</Version> | ||
<Description>core contracts.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>core,cores,base,contract,contracts,dto,dtos</PackageTags> | ||
|
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
25 changes: 25 additions & 0 deletions
25
src/CSharp/EasyMicroservices.Cores.Database/Database/Helpers/DatabaseExtensions.cs
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,25 @@ | ||
using EasyMicroservices.Cores.Database.Interfaces; | ||
using EasyMicroservices.Database.Interfaces; | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace EasyMicroservices.Cores.Database.Helpers; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
internal static class DatabaseExtensions | ||
{ | ||
public static void SetIdToRecordId<TEntity, TRecordEntity>(IContext context, TEntity entity, TRecordEntity recordEntity) | ||
{ | ||
var idProperty = typeof(TRecordEntity) | ||
.GetProperty(nameof(IRecordIdSchema<string>.RecordId), BindingFlags.Public | BindingFlags.Instance); | ||
if (idProperty == null) | ||
throw new Exception($"I cannot find RecordId in your {typeof(TRecordEntity).Name}, Did you inherit from IRecordIdSchema<T>?"); | ||
|
||
var ids = context.GetPrimaryKeyValues(entity); | ||
if (!ids.HasAny()) | ||
throw new Exception($"I cannot find any primary key in your {typeof(TEntity).Name}!"); | ||
idProperty.SetValue(recordEntity, ids.First()); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/CSharp/EasyMicroservices.Cores.Database/Database/Interfaces/IDatabaseWidget.cs
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,24 @@ | ||
using EasyMicroservices.Cores.Interfaces; | ||
using System.Threading.Tasks; | ||
|
||
namespace EasyMicroservices.Cores.Database.Interfaces; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public interface IDatabaseWidget<TEntity, T> : IWidget<T> | ||
where TEntity : class | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
bool CanProcess(IBaseUnitOfWork baseUnitOfWork); | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="databaseWidgetManager"></param> | ||
/// <param name="baseUnitOfWork"></param> | ||
/// <param name="contract"></param> | ||
/// <param name="entity"></param> | ||
/// <returns></returns> | ||
Task Process(IDatabaseWidgetManager databaseWidgetManager, IBaseUnitOfWork baseUnitOfWork, T contract, TEntity entity); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/CSharp/EasyMicroservices.Cores.Database/Database/Interfaces/IDatabaseWidgetManager.cs
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,21 @@ | ||
using EasyMicroservices.Cores.Interfaces; | ||
using System.Threading.Tasks; | ||
|
||
namespace EasyMicroservices.Cores.Database.Interfaces; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public interface IDatabaseWidgetManager : IWidgetManager | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <typeparam name="TEntity"></typeparam> | ||
/// <param name="baseUnitOfWork"></param> | ||
/// <param name="contract"></param> | ||
/// <param name="entity"></param> | ||
/// <returns></returns> | ||
Task Add<T, TEntity>(IBaseUnitOfWork baseUnitOfWork, T contract, TEntity entity) | ||
where TEntity : class; | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/CSharp/EasyMicroservices.Cores.Database/Database/Interfaces/IRecordIdSchema.cs
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,12 @@ | ||
namespace EasyMicroservices.Cores.Database.Interfaces; | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <typeparam name="TId"></typeparam> | ||
public interface IRecordIdSchema<TId> | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public TId RecordId { get; set; } | ||
} |
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
Oops, something went wrong.