diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj index 30b5367..55ed1b9 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj +++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 asp core servces. EasyMicroservices@gmail.com core,cores,base,database,services,asp,aspnet diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj index 26cb5f9..13e291c 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj +++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj @@ -4,7 +4,7 @@ net6.0;net7.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 asp core servces. EasyMicroservices@gmail.com core,cores,base,database,services,asp,aspnet,aspcore,efcore diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/Middlewares/AppAuthorizationMiddleware.cs b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/Middlewares/AppAuthorizationMiddleware.cs index ffb81d9..cf16df6 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/Middlewares/AppAuthorizationMiddleware.cs +++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/Middlewares/AppAuthorizationMiddleware.cs @@ -58,6 +58,7 @@ public async Task Invoke(HttpContext httpContext, IUnitOfWork baseUnitOfWork) httpContext.Response.StatusCode = (int)HttpStatusCode.OK; MessageContract response = FailedReasonType.SessionAccessDenied; response.Error.ServiceDetails.MethodName = httpContext.Request.Path.ToString(); + response.Error.Details = $"StatusCode: {httpContext.Response.StatusCode}"; var json = JsonSerializer.Serialize(response); await httpContext.Response.WriteAsync(json); } diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/UnitOfWork.cs b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/UnitOfWork.cs index 59445f9..333d167 100644 --- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/UnitOfWork.cs +++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/UnitOfWork.cs @@ -3,6 +3,7 @@ using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces; using EasyMicroservices.Cores.Database.Interfaces; using EasyMicroservices.Cores.Database.Logics; +using EasyMicroservices.Cores.Database.Managers; using EasyMicroservices.Cores.Interfaces; using EasyMicroservices.Cores.Models; using EasyMicroservices.Cores.Relational.EntityFrameworkCore; @@ -109,15 +110,16 @@ public virtual IDatabase GetDatabase() return AddDisposable(new EntityFrameworkCoreDatabaseProvider(context)); } + #region ContractLogic /// /// /// /// /// - public virtual IContractLogic GetLongLogic() + public virtual IContractLogic GetLongLogic(LogicOptions logicOptions = default) where TEntity : class { - return GetInternalLongContractLogic(); + return GetInternalLongContractLogic(logicOptions); } /// @@ -126,9 +128,9 @@ public virtual IContractLogic GetLongL /// /// /// - public IContractLogic GetLogic() where TEntity : class + public IContractLogic GetLogic(LogicOptions logicOptions = default) where TEntity : class { - return GetInternalContractLogic(); + return GetInternalContractLogic(logicOptions); } /// @@ -137,11 +139,11 @@ public IContractLogic GetLogic /// /// - public virtual IContractLogic GetLongContractLogic() + public virtual IContractLogic GetLongContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class { - return GetInternalLongContractLogic(); + return GetInternalLongContractLogic(logicOptions); } /// @@ -149,10 +151,10 @@ public virtual IContractLogic Ge /// /// /// - public virtual IContractLogic GetLongReadableLogic() + public virtual IContractLogic GetLongReadableLogic(LogicOptions logicOptions = default) where TEntity : class { - return GetInternalLongContractLogic(); + return GetInternalLongContractLogic(logicOptions); } /// @@ -161,11 +163,11 @@ public virtual IContractLogic GetLongR /// /// /// - public virtual IContractLogic GetLongReadableContractLogic() + public virtual IContractLogic GetLongReadableContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class { - return GetInternalLongContractLogic(); + return GetInternalLongContractLogic(logicOptions); } /// @@ -174,10 +176,10 @@ public virtual IContractLogic Ge /// /// /// - public virtual IContractLogic GetLogic() + public virtual IContractLogic GetLogic(LogicOptions logicOptions = default) where TEntity : class { - return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), GetDatabase().GetWritableOf(), this)); + return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), GetDatabase().GetWritableOf(), this, logicOptions)); } /// @@ -187,11 +189,11 @@ public virtual IContractLogic GetLogic< /// /// /// - public virtual IContractLogic GetContractLogic() + public virtual IContractLogic GetContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class { - return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), GetDatabase().GetWritableOf(), this)); + return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), GetDatabase().GetWritableOf(), this, logicOptions)); } @@ -201,10 +203,10 @@ public virtual IContractLogic Get /// /// /// - public virtual IContractLogic GetReadableLogic() + public virtual IContractLogic GetReadableLogic(LogicOptions logicOptions = default) where TEntity : class { - return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), this)); + return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), this, logicOptions)); } /// @@ -214,92 +216,108 @@ public virtual IContractLogic GetReadab /// /// /// - public virtual IContractLogic GetReadableContractLogic() + public virtual IContractLogic GetReadableContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class { - return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), this)); + return AddDisposable(new IdSchemaDatabaseMappedLogicBase(GetDatabase().GetReadableOf(), this, logicOptions)); } /// /// /// /// + /// + /// /// - public virtual IEasyQueryableAsync GetQueryableOf() - where TEntity : class + /// + public virtual IContractLogic GetLongContractLogic(LogicOptions logicOptions = default) + where TContract : class + where TEntity : class { - return AddDisposable(GetDatabase().GetQueryOf()); + return GetInternalLongContractLogic(logicOptions); } /// /// /// /// + /// + /// + /// /// - public virtual IEasyReadableQueryableAsync GetReadableOf() - where TEntity : class + /// + public virtual IContractLogic GetLongContractLogic(LogicOptions logicOptions = default) + where TResponseContract : class + where TEntity : class { - return AddDisposable(GetDatabase().GetReadableOf()); + return GetInternalLongContractLogic(logicOptions); } /// /// /// /// + /// + /// + /// + /// /// - public virtual IEasyWritableQueryableAsync GetWritableOf() - where TEntity : class + /// + public virtual IContractLogic GetContractLogic(LogicOptions logicOptions = default) + where TResponseContract : class + where TEntity : class { - return AddDisposable(GetDatabase().GetWritableOf()); + return GetInternalContractLogic(logicOptions); + } + + IContractLogic GetInternalLongContractLogic(LogicOptions logicOptions = default) + where TResponseContract : class + where TEntity : class + { + return AddDisposable(new LongIdMappedDatabaseLogicBase(AddDisposable(GetDatabase().GetReadableOf()), AddDisposable(GetDatabase().GetWritableOf()), this, logicOptions)); + } + + IContractLogic GetInternalContractLogic(LogicOptions logicOptions = default) + where TResponseContract : class + where TEntity : class + { + return AddDisposable(new IdSchemaDatabaseMappedLogicBase(AddDisposable(GetDatabase().GetReadableOf()), AddDisposable(GetDatabase().GetWritableOf()), this, logicOptions)); } + #endregion + /// /// /// /// - /// - /// /// - /// - public virtual IContractLogic GetLongContractLogic() - where TContract : class - where TEntity : class + public virtual IEasyQueryableAsync GetQueryableOf() + where TEntity : class { - return GetInternalLongContractLogic(); + return AddDisposable(GetDatabase().GetQueryOf()); } /// /// /// /// - /// - /// - /// /// - /// - public virtual IContractLogic GetLongContractLogic() - where TResponseContract : class - where TEntity : class + public virtual IEasyReadableQueryableAsync GetReadableOf() + where TEntity : class { - return GetInternalLongContractLogic(); + return AddDisposable(GetDatabase().GetReadableOf()); } /// /// /// /// - /// - /// - /// - /// /// - /// - public virtual IContractLogic GetContractLogic() - where TResponseContract : class - where TEntity : class + public virtual IEasyWritableQueryableAsync GetWritableOf() + where TEntity : class { - return GetInternalContractLogic(); + return AddDisposable(GetDatabase().GetWritableOf()); } /// @@ -409,20 +427,6 @@ public virtual void Initialize(string microserviceName, params Type[] dbContextT }; } - IContractLogic GetInternalLongContractLogic() - where TResponseContract : class - where TEntity : class - { - return AddDisposable(new LongIdMappedDatabaseLogicBase(AddDisposable(GetDatabase().GetReadableOf()), AddDisposable(GetDatabase().GetWritableOf()), this)); - } - - IContractLogic GetInternalContractLogic() - where TResponseContract : class - where TEntity : class - { - return AddDisposable(new IdSchemaDatabaseMappedLogicBase(AddDisposable(GetDatabase().GetReadableOf()), AddDisposable(GetDatabase().GetWritableOf()), this)); - } - /// /// /// @@ -436,12 +440,24 @@ public ITextSerializationProvider GetTextSerialization() /// /// /// - public async Task GetCurrentUserUniqueIdentity() + public async Task GetCurrentUserUniqueIdentity(LogicOptions logicOptions = default) { await InitializeWhiteLabel(); var httpContext = ServiceProvider.GetService()?.HttpContext; if (httpContext != null) - return httpContext.User.FindFirst(nameof(IUniqueIdentitySchema.UniqueIdentity))?.Value; + { + var uniqueIdentity = httpContext.User.FindFirst(nameof(IUniqueIdentitySchema.UniqueIdentity))?.Value; + if (uniqueIdentity.HasValue() && logicOptions.UniqueIdentityStrategy != DataTypes.UniqueIdentityStrategy.Default) + { + if (logicOptions.UniqueIdentityStrategy == DataTypes.UniqueIdentityStrategy.BusinessTwoSegment) + return DefaultUniqueIdentityManager.CutUniqueIdentity(uniqueIdentity, 2); + else if (logicOptions.UniqueIdentityStrategy == DataTypes.UniqueIdentityStrategy.UserFourSegment) + return DefaultUniqueIdentityManager.CutUniqueIdentity(uniqueIdentity, 4); + else if (logicOptions.UniqueIdentityStrategy == DataTypes.UniqueIdentityStrategy.ObjectSixSegment) + return DefaultUniqueIdentityManager.CutUniqueIdentity(uniqueIdentity, 6); + } + return uniqueIdentity; + } return null; } diff --git a/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj b/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj index 9ece0f8..d7676b3 100644 --- a/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Clients/EasyMicroservices.Cores.Clients.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 core of database. EasyMicroservices@gmail.com core,cores,base,client,clients diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/DataTypes/UniqueIdentityStrategy.cs b/src/CSharp/EasyMicroservices.Cores.Contracts/DataTypes/UniqueIdentityStrategy.cs new file mode 100644 index 0000000..fe5d7d9 --- /dev/null +++ b/src/CSharp/EasyMicroservices.Cores.Contracts/DataTypes/UniqueIdentityStrategy.cs @@ -0,0 +1,47 @@ +namespace EasyMicroservices.Cores.DataTypes; +/// +/// +/// +public enum UniqueIdentityStrategy : byte +{ + /// + /// value is none, Never use the None to return values + /// + None = 0, + /// + /// error value is default + /// + Default = 1, + /// + /// for the filter values from web admin panel you can sent all for types + /// + All = 2, + /// + /// there is other error that is not in the types + /// + Other = 3, + /// + /// the error type is uknown to us + /// + Unknown = 4, + /// + /// there is nothing to show or validate error + /// + Nothing = 5, + /// + /// + /// + Full = 6, + /// + /// + /// + BusinessTwoSegment = 7, + /// + /// + /// + UserFourSegment = 8, + /// + /// + /// + ObjectSixSegment = 9 +} diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj index 1824172..d428f06 100644 --- a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 core contracts. EasyMicroservices@gmail.com core,cores,base,contract,contracts,dto,dtos diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/Models/LogicOptions.cs b/src/CSharp/EasyMicroservices.Cores.Contracts/Models/LogicOptions.cs new file mode 100644 index 0000000..c536daa --- /dev/null +++ b/src/CSharp/EasyMicroservices.Cores.Contracts/Models/LogicOptions.cs @@ -0,0 +1,33 @@ +using EasyMicroservices.Cores.DataTypes; +using System; + +namespace EasyMicroservices.Cores.Models; +/// +/// +/// +public struct LogicOptions +{ + /// + /// + /// + public LogicOptions() + { + + } + /// + /// + /// + public UniqueIdentityStrategy UniqueIdentityStrategy { get; set; } = UniqueIdentityStrategy.Default; + /// + /// + /// + /// + + public static implicit operator LogicOptions(UniqueIdentityStrategy uniqueIdentityStrategy) + { + return new LogicOptions() + { + UniqueIdentityStrategy = uniqueIdentityStrategy + }; + } +} diff --git a/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/DatabaseLogicInfrastructure.cs b/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/DatabaseLogicInfrastructure.cs index af7190d..152e44b 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/DatabaseLogicInfrastructure.cs +++ b/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/DatabaseLogicInfrastructure.cs @@ -3,6 +3,7 @@ using EasyMicroservices.Cores.Database.Managers; using EasyMicroservices.Cores.DataTypes; using EasyMicroservices.Cores.Interfaces; +using EasyMicroservices.Cores.Models; using EasyMicroservices.Database.Interfaces; using EasyMicroservices.Mapper.Interfaces; using EasyMicroservices.ServiceContracts; @@ -29,12 +30,15 @@ public class DatabaseLogicInfrastructure : IDisposable /// internal protected readonly IMapperProvider MapperProvider; readonly IBaseUnitOfWork _baseUnitOfWork; + readonly LogicOptions _logicOptions; /// /// /// /// - public DatabaseLogicInfrastructure(IBaseUnitOfWork baseUnitOfWork) + /// + public DatabaseLogicInfrastructure(IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) { + _logicOptions = logicOptions; _baseUnitOfWork = baseUnitOfWork; MapperProvider = baseUnitOfWork.GetMapper(); } @@ -61,7 +65,7 @@ private async Task CheckUniqueIdentityAccess(params IEntityEntr { bool hasUniqueIdentityRole = await _baseUnitOfWork.HasUniqueIdentityRole(); - var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(); + var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions); foreach (var item in items) { if (item.Entity is IUniqueIdentitySchema uniqueIdentitySchema) @@ -83,13 +87,15 @@ private async Task CheckUniqueIdentityAccess(params IEntityEntr private async Task HasUniqueIdentityPermission(string uniqueIdentity) where TEntity : class { + if (_logicOptions.UniqueIdentityStrategy == UniqueIdentityStrategy.Full) + return true; bool hasUniqueIdentityRole = await _baseUnitOfWork.HasUniqueIdentityRole(); if (hasUniqueIdentityRole) return true; if (!typeof(IUniqueIdentitySchema).IsAssignableFrom(typeof(TEntity))) return (FailedReasonType.AccessDenied, $"type of {typeof(TEntity)} is not inheritance from IUniqueIdentitySchema and user has no UniqueIdentityRole access!"); - var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(); + var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions); if (uniqueIdentity.IsNullOrEmpty() && !hasUniqueIdentityRole) return (FailedReasonType.AccessDenied, $"With the UniqueIdentity: {currentUserUniqueIdentity} you have not access, please send me your UniqueIdentity!"); else if (!uniqueIdentity.StartsWith(currentUserUniqueIdentity)) @@ -104,7 +110,7 @@ private async Task> UniqueIdentityQueryMake if (uniqueIdentity.IsNullOrEmpty()) return easyReadableQueryable; var uniqueIdentityManager = await GetIUniqueIdentityManager(); - var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(); + var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions); IEasyReadableQueryableAsync queryable = easyReadableQueryable; if (!uniqueIdentityManager.IsUniqueIdentityForThisTable(easyReadableQueryable.Context, uniqueIdentity)) @@ -141,7 +147,7 @@ private async Task> SetTheUserUniqueIdentit var uniqueIdentityPermission = await HasUniqueIdentityPermission(null); string uniqueIdentity = default; if (!uniqueIdentityPermission) - uniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(); + uniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions); return await UniqueIdentityQueryMaker(easyReadableQueryable, uniqueIdentity, GetUniqueIdentityType.All); } @@ -935,7 +941,7 @@ public async Task> Add(IEasyWritableQueryableA await easyWritableQueryable.SaveChangesAsync(); if (typeof(IUniqueIdentitySchema).IsAssignableFrom(typeof(TEntity))) { - var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(); + var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions); var uniqueIdentityManager = await GetIUniqueIdentityManager(); if (uniqueIdentityManager.UpdateUniqueIdentity(currentUserUniqueIdentity, easyWritableQueryable.Context, result.Entity)) { @@ -977,7 +983,7 @@ public async Task> AddBulk(IEasyWritableQu bool anyUpdate = false; if (typeof(IUniqueIdentitySchema).IsAssignableFrom(typeof(TEntity))) { - var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(); + var currentUserUniqueIdentity = await _baseUnitOfWork.GetCurrentUserUniqueIdentity(_logicOptions); var uniqueIdentityManager = await GetIUniqueIdentityManager(); foreach (var item in result) { diff --git a/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/IdSchemaDatabaseMappedLogicBase.cs b/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/IdSchemaDatabaseMappedLogicBase.cs index 64ed346..772c0b6 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/IdSchemaDatabaseMappedLogicBase.cs +++ b/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/IdSchemaDatabaseMappedLogicBase.cs @@ -2,6 +2,7 @@ using EasyMicroservices.Cores.Database.Interfaces; using EasyMicroservices.Cores.DataTypes; using EasyMicroservices.Cores.Interfaces; +using EasyMicroservices.Cores.Models; using EasyMicroservices.Database.Interfaces; using EasyMicroservices.ServiceContracts; using System; @@ -32,7 +33,8 @@ public class IdSchemaDatabaseMappedLogicBase /// /// - public IdSchemaDatabaseMappedLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IBaseUnitOfWork baseUnitOfWork) : base(baseUnitOfWork) + /// + public IdSchemaDatabaseMappedLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) : base(baseUnitOfWork, logicOptions) { _easyReadableQueryable = easyReadableQueryable; } @@ -42,7 +44,8 @@ public IdSchemaDatabaseMappedLogicBase(IEasyReadableQueryableAsync easy /// /// /// - public IdSchemaDatabaseMappedLogicBase(IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork) : base(baseUnitOfWork) + /// + public IdSchemaDatabaseMappedLogicBase(IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) : base(baseUnitOfWork, logicOptions) { _easyWriteableQueryable = easyWriteableQueryable; } @@ -53,7 +56,8 @@ public IdSchemaDatabaseMappedLogicBase(IEasyWritableQueryableAsync easy /// /// /// - public IdSchemaDatabaseMappedLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork) : base(baseUnitOfWork) + /// + public IdSchemaDatabaseMappedLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) : base(baseUnitOfWork, logicOptions) { _easyWriteableQueryable = easyWriteableQueryable; _easyReadableQueryable = easyReadableQueryable; diff --git a/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/LongIdMappedDatabaseLogicBase.cs b/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/LongIdMappedDatabaseLogicBase.cs index 596e423..9114101 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/LongIdMappedDatabaseLogicBase.cs +++ b/src/CSharp/EasyMicroservices.Cores.Database/Database/Logics/LongIdMappedDatabaseLogicBase.cs @@ -1,4 +1,5 @@ using EasyMicroservices.Cores.Interfaces; +using EasyMicroservices.Cores.Models; using EasyMicroservices.Database.Interfaces; namespace EasyMicroservices.Cores.Database.Logics @@ -19,7 +20,8 @@ public class LongIdMappedDatabaseLogicBase /// /// - public LongIdMappedDatabaseLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IBaseUnitOfWork baseUnitOfWork) : base(easyReadableQueryable, baseUnitOfWork) + /// + public LongIdMappedDatabaseLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) : base(easyReadableQueryable, baseUnitOfWork, logicOptions) { } @@ -28,7 +30,8 @@ public LongIdMappedDatabaseLogicBase(IEasyReadableQueryableAsync easyRe /// /// /// - public LongIdMappedDatabaseLogicBase(IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork) : base(easyWriteableQueryable, baseUnitOfWork) + /// + public LongIdMappedDatabaseLogicBase(IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) : base(easyWriteableQueryable, baseUnitOfWork, logicOptions) { } @@ -38,7 +41,8 @@ public LongIdMappedDatabaseLogicBase(IEasyWritableQueryableAsync easyWr /// /// /// - public LongIdMappedDatabaseLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork) : base(easyReadableQueryable, easyWriteableQueryable, baseUnitOfWork) + /// + public LongIdMappedDatabaseLogicBase(IEasyReadableQueryableAsync easyReadableQueryable, IEasyWritableQueryableAsync easyWriteableQueryable, IBaseUnitOfWork baseUnitOfWork, LogicOptions logicOptions = default) : base(easyReadableQueryable, easyWriteableQueryable, baseUnitOfWork, logicOptions) { } diff --git a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj index 11b6e5e..13ced46 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj @@ -4,7 +4,7 @@ netstandard2.0;netstandard2.1;net45;net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 core of database. EasyMicroservices@gmail.com core,cores,base,database diff --git a/src/CSharp/EasyMicroservices.Cores.Database/Interfaces/IBaseUnitOfWork.cs b/src/CSharp/EasyMicroservices.Cores.Database/Interfaces/IBaseUnitOfWork.cs index 4a6ef3a..1cecad8 100644 --- a/src/CSharp/EasyMicroservices.Cores.Database/Interfaces/IBaseUnitOfWork.cs +++ b/src/CSharp/EasyMicroservices.Cores.Database/Interfaces/IBaseUnitOfWork.cs @@ -1,4 +1,5 @@ using EasyMicroservices.Cores.Database.Interfaces; +using EasyMicroservices.Cores.DataTypes; using EasyMicroservices.Cores.Models; using EasyMicroservices.Database.Interfaces; using EasyMicroservices.Mapper.Interfaces; @@ -47,7 +48,7 @@ public interface IBaseUnitOfWork : IDisposable /// /// /// - Task GetCurrentUserUniqueIdentity(); + Task GetCurrentUserUniqueIdentity(LogicOptions logicOptions = default); /// /// /// @@ -63,12 +64,14 @@ public interface IBaseUnitOfWork : IDisposable /// /// IContentResolver GetContentResolver(); + + #region ContractLogics /// /// /// /// /// - IContractLogic GetLongLogic() + IContractLogic GetLongLogic(LogicOptions logicOptions = default) where TEntity : class; /// /// @@ -76,7 +79,7 @@ IContractLogic GetLongLogic() /// /// /// - IContractLogic GetLongContractLogic() + IContractLogic GetLongContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class; @@ -85,7 +88,7 @@ IContractLogic GetLongContractLo /// /// /// - IContractLogic GetLongReadableLogic() + IContractLogic GetLongReadableLogic(LogicOptions logicOptions = default) where TEntity : class; /// @@ -94,7 +97,7 @@ IContractLogic GetLongReadableLogic /// /// - IContractLogic GetLongReadableContractLogic() + IContractLogic GetLongReadableContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class; @@ -104,7 +107,7 @@ IContractLogic GetLongReadableCo /// /// /// - IContractLogic GetLogic() + IContractLogic GetLogic(LogicOptions logicOptions = default) where TEntity : class; /// @@ -112,7 +115,7 @@ IContractLogic GetLogic() /// /// /// - IContractLogic GetLogic() + IContractLogic GetLogic(LogicOptions logicOptions = default) where TEntity : class; /// @@ -122,7 +125,7 @@ IContractLogic GetLogic() /// /// /// - IContractLogic GetContractLogic() + IContractLogic GetContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class; @@ -133,7 +136,7 @@ IContractLogic GetContractLogic /// /// - IContractLogic GetReadableLogic() + IContractLogic GetReadableLogic(LogicOptions logicOptions = default) where TEntity : class; /// /// @@ -142,7 +145,7 @@ IContractLogic GetReadableLogic /// /// - IContractLogic GetReadableContractLogic() + IContractLogic GetReadableContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class; /// @@ -153,7 +156,7 @@ IContractLogic GetReadableContrac /// /// /// - IContractLogic GetLongContractLogic() + IContractLogic GetLongContractLogic(LogicOptions logicOptions = default) where TContract : class where TEntity : class; /// @@ -165,7 +168,7 @@ IContractLogic GetL /// /// /// - IContractLogic GetLongContractLogic() + IContractLogic GetLongContractLogic(LogicOptions logicOptions = default) where TResponseContract : class where TEntity : class; @@ -179,9 +182,11 @@ IContractLogic /// /// - IContractLogic GetContractLogic() + IContractLogic GetContractLogic(LogicOptions logicOptions = default) where TResponseContract : class where TEntity : class; + #endregion + /// /// /// diff --git a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj index f7b5bb8..c7b45fd 100644 --- a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj +++ b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 ef core of database. EasyMicroservices@gmail.com core,cores,base,database,ef,efcore diff --git a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj index f1f0383..1653c2c 100644 --- a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj +++ b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj @@ -4,7 +4,7 @@ net6.0;net8.0 AnyCPU;x64;x86 EasyMicroservices - 0.0.0.93 + 0.0.0.94 ef core of Relational database. EasyMicroservices@gmail.com core,cores,base,database,ef,efcore,Relational