Skip to content

Commit

Permalink
async one bg thread implemented for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
bberka committed Feb 14, 2023
1 parent d99125b commit 06b8302
Show file tree
Hide file tree
Showing 162 changed files with 1,020 additions and 485 deletions.
Binary file modified .vs/EasMe/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/EasMe/v17/.futdcache.v2
Binary file not shown.
Binary file modified .vs/EasMe/v17/.suo
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/easme.metadata.v5.2
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/easme.projects.v5.2
Binary file not shown.
45 changes: 0 additions & 45 deletions EasMe.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,82 +33,37 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
REAL_RLS|Any CPU = REAL_RLS|Any CPU
Release|Any CPU = Release|Any CPU
TEST_RLS|Any CPU = TEST_RLS|Any CPU
TESTSERVER|Any CPU = TESTSERVER|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.REAL_RLS|Any CPU.ActiveCfg = Release|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.REAL_RLS|Any CPU.Build.0 = Release|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.Release|Any CPU.Build.0 = Release|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.TEST_RLS|Any CPU.ActiveCfg = Debug|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.TEST_RLS|Any CPU.Build.0 = Debug|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.TESTSERVER|Any CPU.ActiveCfg = Debug|Any CPU
{0585DB88-C6D4-4F6F-8529-529D091AD46F}.TESTSERVER|Any CPU.Build.0 = Debug|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.REAL_RLS|Any CPU.ActiveCfg = Release|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.REAL_RLS|Any CPU.Build.0 = Release|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.Release|Any CPU.Build.0 = Release|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.TEST_RLS|Any CPU.ActiveCfg = Debug|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.TEST_RLS|Any CPU.Build.0 = Debug|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.TESTSERVER|Any CPU.ActiveCfg = Debug|Any CPU
{EC1E7E82-7CF2-457A-834D-3028AC063B35}.TESTSERVER|Any CPU.Build.0 = Debug|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.REAL_RLS|Any CPU.ActiveCfg = Release|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.REAL_RLS|Any CPU.Build.0 = Release|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.Release|Any CPU.Build.0 = Release|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.TEST_RLS|Any CPU.ActiveCfg = Debug|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.TEST_RLS|Any CPU.Build.0 = Debug|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.TESTSERVER|Any CPU.ActiveCfg = Debug|Any CPU
{E38DE084-ACAD-47A0-BC96-D5B1BC8782FB}.TESTSERVER|Any CPU.Build.0 = Debug|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.REAL_RLS|Any CPU.ActiveCfg = Release|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.REAL_RLS|Any CPU.Build.0 = Release|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.Release|Any CPU.Build.0 = Release|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.TEST_RLS|Any CPU.ActiveCfg = Debug|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.TEST_RLS|Any CPU.Build.0 = Debug|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.TESTSERVER|Any CPU.ActiveCfg = Debug|Any CPU
{3743A327-72BD-40E8-901D-27965AE54CF4}.TESTSERVER|Any CPU.Build.0 = Debug|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.REAL_RLS|Any CPU.ActiveCfg = Release|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.REAL_RLS|Any CPU.Build.0 = Release|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.Release|Any CPU.Build.0 = Release|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.TEST_RLS|Any CPU.ActiveCfg = Debug|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.TEST_RLS|Any CPU.Build.0 = Debug|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.TESTSERVER|Any CPU.ActiveCfg = Debug|Any CPU
{A34014DE-E353-44E7-874F-CFD7E3F16137}.TESTSERVER|Any CPU.Build.0 = Debug|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.REAL_RLS|Any CPU.ActiveCfg = Release|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.REAL_RLS|Any CPU.Build.0 = Release|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.Release|Any CPU.Build.0 = Release|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.TEST_RLS|Any CPU.ActiveCfg = Debug|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.TEST_RLS|Any CPU.Build.0 = Debug|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.TESTSERVER|Any CPU.ActiveCfg = Debug|Any CPU
{3949256E-4A81-4CEB-BD17-F24C876B2113}.TESTSERVER|Any CPU.Build.0 = Debug|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.REAL_RLS|Any CPU.ActiveCfg = REAL_RLS|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.REAL_RLS|Any CPU.Build.0 = REAL_RLS|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.Release|Any CPU.Build.0 = Release|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.TEST_RLS|Any CPU.ActiveCfg = TEST_RLS|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.TEST_RLS|Any CPU.Build.0 = TEST_RLS|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.TESTSERVER|Any CPU.ActiveCfg = TESTSERVER|Any CPU
{EB7007B1-55FB-4C40-8BA1-966046B78851}.TESTSERVER|Any CPU.Build.0 = TESTSERVER|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 6 additions & 6 deletions src/EasMe.Authorization/Filters/HasPermissionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,30 @@ public HasPermissionAttribute(object actionCode)

private readonly string _actionCode;

public override void OnActionExecuting(ActionExecutingContext context)
public override void OnActionExecuting(ActionExecutingContext _dbContext)
{
if (context.HttpContext.User.Identity is not { IsAuthenticated: true })
if (_dbContext.HttpContext.User.Identity is not { IsAuthenticated: true })
{
Trace.WriteLine("Not authorized");
return;
}
var endPointPermissionString = context.HttpContext.User.FindFirst(EasMeClaimType.EndPointPermissions)?.Value ?? "";
var endPointPermissionString = _dbContext.HttpContext.User.FindFirst(EasMeClaimType.EndPointPermissions)?.Value ?? "";
if (string.IsNullOrEmpty(endPointPermissionString))
{
context.Result = new ForbidResult();
_dbContext.Result = new ForbidResult();
return;
}
Trace.WriteLine(endPointPermissionString);
var permList = AuthorizationHelper.SplitPermissions(endPointPermissionString);
Trace.WriteLine("Permission List" + JsonConvert.SerializeObject(permList));
if (permList.Length == 0)
{
context.Result = new ForbidResult();
_dbContext.Result = new ForbidResult();
return;
}
if (!permList.Contains(_actionCode))
{
context.Result = new ForbidResult();
_dbContext.Result = new ForbidResult();
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ public HttpMethodAuthorizationMiddleware(RequestDelegate next)
_next = next;
}

public async Task InvokeAsync(HttpContext context)
public async Task InvokeAsync(HttpContext _dbContext)
{
if (context.User.Identity is not { IsAuthenticated: true })
if (_dbContext.User.Identity is not { IsAuthenticated: true })
{
await _next(context);
await _next(_dbContext);
return;
}

var permissionString = context.User.FindFirst(EasMeClaimType.HttpMethodPermissions)?.Value ?? "";
var permissionString = _dbContext.User.FindFirst(EasMeClaimType.HttpMethodPermissions)?.Value ?? "";
var permList = AuthorizationHelper.SplitPermissions(permissionString);
if (permList.Length == 0)
{
context.Response.StatusCode = 403;
_dbContext.Response.StatusCode = 403;
return;
}
var httpMethod = context.Request.Method;
var httpMethod = _dbContext.Request.Method;
if(!permList.Contains(httpMethod))
{
context.Response.StatusCode = 403;
_dbContext.Response.StatusCode = 403;
return;
}
await _next(context);
await _next(_dbContext);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = EasMe.Authorization
build_property.ProjectDir = e:\Repos\easme-lib\src\EasMe.Authorization\
build_property.ProjectDir = E:\Repos\easme-lib\src\EasMe.Authorization\
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ E:\Repos\easme-lib\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.dll
E:\Repos\easme-lib\EasMe.Authorization\obj\Debug\net6.0\refint\EasMe.Authorization.dll
E:\Repos\easme-lib\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.pdb
E:\Repos\easme-lib\EasMe.Authorization\obj\Debug\net6.0\ref\EasMe.Authorization.dll
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.csproj.AssemblyReference.cache
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.GeneratedMSBuildEditorConfig.editorconfig
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.AssemblyInfoInputs.cache
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.AssemblyInfo.cs
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.csproj.CoreCompileInputs.cache
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.dll
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\refint\EasMe.Authorization.dll
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\EasMe.Authorization.pdb
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Debug\net6.0\ref\EasMe.Authorization.dll
Binary file modified src/EasMe.Authorization/obj/Debug/net6.0/EasMe.Authorization.dll
Binary file not shown.
Binary file modified src/EasMe.Authorization/obj/Debug/net6.0/EasMe.Authorization.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = EasMe.Authorization
build_property.ProjectDir = E:\Repos\easme-lib\EasMe.Authorization\
build_property.ProjectDir = E:\Repos\easme-lib\src\EasMe.Authorization\
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ E:\Repos\easme-lib\EasMe.Authorization\obj\Release\net6.0\ref\EasMe.Authorizatio
E:\Repos\easme-lib\bin\Release\net6.0\EasMe.Authorization.deps.json
E:\Repos\easme-lib\bin\Release\net6.0\EasMe.Authorization.dll
E:\Repos\easme-lib\bin\Release\net6.0\EasMe.Authorization.pdb
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.csproj.AssemblyReference.cache
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.GeneratedMSBuildEditorConfig.editorconfig
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.AssemblyInfoInputs.cache
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.AssemblyInfo.cs
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.csproj.CoreCompileInputs.cache
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.dll
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\refint\EasMe.Authorization.dll
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\EasMe.Authorization.pdb
E:\Repos\easme-lib\src\EasMe.Authorization\obj\Release\net6.0\ref\EasMe.Authorization.dll
Binary file not shown.
Binary file modified src/EasMe.Authorization/obj/Release/net6.0/EasMe.Authorization.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/EasMe.Box/bin/Debug/EasMe.MessageBox.dll
Binary file not shown.
Binary file modified src/EasMe.Box/bin/Debug/EasMe.MessageBox.pdb
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions src/EasMe.Box/obj/Debug/EasMe.Box.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ E:\Repos\easme-lib\EasMe.Box\obj\Debug\EasMe.Box.csproj.AssemblyReference.cache
E:\Repos\easme-lib\EasMe.Box\obj\Debug\EasMe.Box.csproj.CoreCompileInputs.cache
E:\Repos\easme-lib\EasMe.Box\obj\Debug\EasMe.MessageBox.dll
E:\Repos\easme-lib\EasMe.Box\obj\Debug\EasMe.MessageBox.pdb
E:\Repos\easme-lib\src\EasMe.Box\bin\Debug\EasMe.MessageBox.dll
E:\Repos\easme-lib\src\EasMe.Box\bin\Debug\EasMe.MessageBox.pdb
E:\Repos\easme-lib\src\EasMe.Box\obj\Debug\EasMe.Box.csproj.AssemblyReference.cache
E:\Repos\easme-lib\src\EasMe.Box\obj\Debug\EasMe.Box.csproj.CoreCompileInputs.cache
E:\Repos\easme-lib\src\EasMe.Box\obj\Debug\EasMe.MessageBox.dll
E:\Repos\easme-lib\src\EasMe.Box\obj\Debug\EasMe.MessageBox.pdb
Binary file modified src/EasMe.Box/obj/Debug/EasMe.MessageBox.dll
Binary file not shown.
Binary file modified src/EasMe.Box/obj/Debug/EasMe.MessageBox.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ E:\Repos\easme-lib\EasMe.Box\obj\Release\EasMe.Box.csproj.AssemblyReference.cach
E:\Repos\easme-lib\EasMe.Box\obj\Release\EasMe.Box.csproj.CoreCompileInputs.cache
E:\Repos\easme-lib\EasMe.Box\obj\Release\EasMe.MessageBox.dll
E:\Repos\easme-lib\EasMe.Box\obj\Release\EasMe.MessageBox.pdb
E:\Repos\easme-lib\src\bin\EasMe.MessageBox.dll
E:\Repos\easme-lib\src\bin\EasMe.MessageBox.pdb
E:\Repos\easme-lib\src\EasMe.Box\obj\Release\EasMe.Box.csproj.AssemblyReference.cache
E:\Repos\easme-lib\src\EasMe.Box\obj\Release\EasMe.Box.csproj.CoreCompileInputs.cache
E:\Repos\easme-lib\src\EasMe.Box\obj\Release\EasMe.MessageBox.dll
E:\Repos\easme-lib\src\EasMe.Box\obj\Release\EasMe.MessageBox.pdb
Binary file modified src/EasMe.Box/obj/Release/EasMe.MessageBox.dll
Binary file not shown.
Binary file modified src/EasMe.Box/obj/Release/EasMe.MessageBox.pdb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

namespace EasMe.EntityFrameworkCore.Abstract
{
public interface IEfEntity
public interface IBaseEntity : IEquatable<BaseEntity>
{
Guid Id { get; init; }
}
}
35 changes: 0 additions & 35 deletions src/EasMe.EntityFrameworkCore/Abstract/IEfEntityRepository.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/EasMe.EntityFrameworkCore/Abstract/IEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

namespace EasMe.EntityFrameworkCore.Abstract
{
public interface IEntity : IEquatable<Entity>
public interface IEntity
{
Guid Id { get; init; }
}
}
37 changes: 37 additions & 0 deletions src/EasMe.EntityFrameworkCore/Abstract/IEntityRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Linq.Expressions;

namespace EasMe.EntityFrameworkCore.Abstract
{
public interface IEntityRepository<T>
where T : class, IEntity, new()
{
IQueryable<T> Get(Expression<Func<T, bool>>? filter = null);
List<T> GetList(Expression<Func<T, bool>>? filter = null);
bool Any(Expression<Func<T, bool>> filter);
bool Any();
T? GetFirstOrDefault(Expression<Func<T, bool>> filter);
T? GetFirst(Expression<Func<T, bool>> filter);
T GetSingle(Expression<Func<T, bool>> filter);
T? GetSingleOrDefault(Expression<Func<T, bool>> filter);
T GetSingle();
T? GetFirst();
void Add(T entity);
void AddRange(IEnumerable<T> entities);
void Update(T entity);
void Update(T entity, Action<T> updateAction);
void UpdateRange(IEnumerable<T> entities);
//int UpdateWhere(Expression<Func<T, bool>> filter, Action<T> updateAction);
//int DeleteWhere(Expression<Func<T, bool>> filter);
//bool UpdateWhereSingle(Expression<Func<T, bool>> filter, Action<T> updateAction);
//bool DeleteWhereSingle(Expression<Func<T, bool>> filter);
void Delete(T entity);
void Delete(int id);
void DeleteRange(IEnumerable<T> entities);
T? Find(int id);
int Count(Expression<Func<T, bool>> filter);
int Count();
//bool Save();
//Task<bool> SaveAsync();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace EasMe.EntityFrameworkCore
{
public abstract class Entity : IEntity
public abstract class BaseEntity : IBaseEntity
{
protected Entity(Guid guid)
protected BaseEntity(Guid guid)
{
Id = guid;
}
Expand All @@ -14,16 +14,16 @@ protected Entity(Guid guid)
public Guid Id { get; init; }


public static bool operator ==(Entity? left, Entity? right)
public static bool operator ==(BaseEntity? left, BaseEntity? right)
{
return left is not null && right is not null && left.Equals(right);
}
public static bool operator !=(Entity? left, Entity? right)
public static bool operator !=(BaseEntity? left, BaseEntity? right)
{
return left?.Equals(right) == true;
}

public bool Equals(Entity? other)
public bool Equals(BaseEntity? other)
{
if(other is null ) return false;
if(GetType() != other.GetType()) return false;
Expand All @@ -33,7 +33,7 @@ public override bool Equals(object? obj)
{
if (obj is null) return false;
if (GetType() != obj.GetType()) return false;
if(obj is not Entity entity) return false;
if(obj is not BaseEntity entity) return false;
return Id == entity.Id;
}
public override int GetHashCode()
Expand Down
Loading

0 comments on commit 06b8302

Please sign in to comment.