diff --git a/src/Framework.AutomationCore/Framework.AutomationCore.csproj b/src/Framework.AutomationCore/Framework.AutomationCore.csproj index 24edb131c..cae3b9a4e 100644 --- a/src/Framework.AutomationCore/Framework.AutomationCore.csproj +++ b/src/Framework.AutomationCore/Framework.AutomationCore.csproj @@ -9,10 +9,10 @@ - - + + - + diff --git a/src/Framework.Cap/Auth/CapAuthenticationHandler.cs b/src/Framework.Cap/Auth/CapAuthenticationHandler.cs index 27b3e85bb..67aead5d8 100644 --- a/src/Framework.Cap/Auth/CapAuthenticationHandler.cs +++ b/src/Framework.Cap/Auth/CapAuthenticationHandler.cs @@ -1,4 +1,5 @@ -using System.Text.Encodings.Web; +using System; +using System.Text.Encodings.Web; using System.Threading.Tasks; using Framework.Authorization.BLL; @@ -15,16 +16,23 @@ namespace Framework.Cap.Auth; public class CapAuthenticationHandler : AuthenticationHandler where TBllContext : IAuthorizationBLLContextContainer { - private readonly IServiceEnvironment environment; + private readonly TBllContext context; + + private readonly IDBSession dbSession; public CapAuthenticationHandler( + IServiceProvider rootServiceProvider, IOptionsMonitor options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, - IServiceEnvironment environment) - : base(options, logger, encoder, clock) => - this.environment = environment; + TBllContext context, + IDBSession dbSession) + : base(options, logger, encoder, clock) + { + this.context = context; + this.dbSession = dbSession; + } protected override Task HandleAuthenticateAsync() { @@ -35,22 +43,16 @@ protected override Task HandleAuthenticateAsync() return Task.FromResult(AuthenticateResult.NoResult()); } - var isAdmin = this.environment - .GetContextEvaluator() - .Evaluate( - DBSessionMode.Read, - z => z.Authorization.Logics.BusinessRole.HasAdminRole()); + this.dbSession.AsReadOnly(); + + var isAdmin = this.context.Authorization.Logics.BusinessRole.HasAdminRole(); if (!isAdmin) { return Task.FromResult(AuthenticateResult.NoResult()); } - var authenticationTicket = new AuthenticationTicket( - httpContext.User, - DependencyInjections - .CapAuthenticationScheme); + var authenticationTicket = new AuthenticationTicket(httpContext.User, DependencyInjections.CapAuthenticationScheme); return Task.FromResult(AuthenticateResult.Success(authenticationTicket)); - } } diff --git a/src/Framework.Cap/Framework.Cap.csproj b/src/Framework.Cap/Framework.Cap.csproj index 4736fef2c..74f0a752c 100644 --- a/src/Framework.Cap/Framework.Cap.csproj +++ b/src/Framework.Cap/Framework.Cap.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/Framework.Core.Delegate/Framework.Core.Delegate.csproj b/src/Framework.Core.Delegate/Framework.Core.Delegate.csproj index a89cd26f7..73079673d 100644 --- a/src/Framework.Core.Delegate/Framework.Core.Delegate.csproj +++ b/src/Framework.Core.Delegate/Framework.Core.Delegate.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Framework.Core.DictionaryCache/Framework.Core.DictionaryCache.csproj b/src/Framework.Core.DictionaryCache/Framework.Core.DictionaryCache.csproj index 986548f0b..9fa8b42d5 100644 --- a/src/Framework.Core.DictionaryCache/Framework.Core.DictionaryCache.csproj +++ b/src/Framework.Core.DictionaryCache/Framework.Core.DictionaryCache.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Framework.Core.String/Framework.Core.String.csproj b/src/Framework.Core.String/Framework.Core.String.csproj index eba8db9e3..ae15176e2 100644 --- a/src/Framework.Core.String/Framework.Core.String.csproj +++ b/src/Framework.Core.String/Framework.Core.String.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Framework.Core.Tests.Unit/Framework.Core.Tests.Unit.csproj b/src/Framework.Core.Tests.Unit/Framework.Core.Tests.Unit.csproj index bdc670489..52de1bf71 100644 --- a/src/Framework.Core.Tests.Unit/Framework.Core.Tests.Unit.csproj +++ b/src/Framework.Core.Tests.Unit/Framework.Core.Tests.Unit.csproj @@ -3,13 +3,13 @@ false - - - - + + + + - + diff --git a/src/Framework.Core.TypeImplementationToolkit/Framework.Core.TypeImplementationToolkit.csproj b/src/Framework.Core.TypeImplementationToolkit/Framework.Core.TypeImplementationToolkit.csproj index 9db47d836..c7c7757ea 100644 --- a/src/Framework.Core.TypeImplementationToolkit/Framework.Core.TypeImplementationToolkit.csproj +++ b/src/Framework.Core.TypeImplementationToolkit/Framework.Core.TypeImplementationToolkit.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Framework.Core.VisistedQueryable/Framework.Core.VisistedQueryable.csproj b/src/Framework.Core.VisistedQueryable/Framework.Core.VisistedQueryable.csproj index faccead5a..d20f6960c 100644 --- a/src/Framework.Core.VisistedQueryable/Framework.Core.VisistedQueryable.csproj +++ b/src/Framework.Core.VisistedQueryable/Framework.Core.VisistedQueryable.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Framework.Core/Extensions/CoreExpressionExtensions.cs b/src/Framework.Core/Extensions/CoreExpressionExtensions.cs index 648a09387..c802b0f32 100644 --- a/src/Framework.Core/Extensions/CoreExpressionExtensions.cs +++ b/src/Framework.Core/Extensions/CoreExpressionExtensions.cs @@ -83,6 +83,19 @@ from property in (member as PropertyInfo).ToMaybe() return request.GetValue(() => new System.ArgumentException("not property expression", nameof(expr))); } + public static FieldInfo GetField(this Expression> expr) + { + if (expr == null) throw new ArgumentNullException(nameof(expr)); + + var request = from member in expr.Body.GetMember() + + from field in (member as FieldInfo).ToMaybe() + + select field; + + return request.GetValue(() => new System.ArgumentException("not field expression", nameof(expr))); + } + /// /// Получение полного пути из Expression /// diff --git a/src/Framework.Core/Framework.Core.csproj b/src/Framework.Core/Framework.Core.csproj index ca2ff24e2..29ebe3249 100644 --- a/src/Framework.Core/Framework.Core.csproj +++ b/src/Framework.Core/Framework.Core.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/Framework.Core/MessageSender/IMessageSender.cs b/src/Framework.Core/MessageSender/IMessageSender.cs index 7863e3ccb..7adf220ae 100644 --- a/src/Framework.Core/MessageSender/IMessageSender.cs +++ b/src/Framework.Core/MessageSender/IMessageSender.cs @@ -10,7 +10,6 @@ public interface IMessageSender /// Sends message /// /// Message to send - /// Message send mode - void Send(TMessage message, TransactionMessageMode sendMessageMode = TransactionMessageMode.Auto); + void Send(TMessage message); } } diff --git a/src/Framework.Core/MessageSender/MessageSender.cs b/src/Framework.Core/MessageSender/MessageSender.cs index 460cbdf34..51c873fc6 100644 --- a/src/Framework.Core/MessageSender/MessageSender.cs +++ b/src/Framework.Core/MessageSender/MessageSender.cs @@ -5,7 +5,7 @@ namespace Framework.Core { public abstract class MessageSender : IMessageSender { - public abstract void Send(TMessage message, TransactionMessageMode transactionMessageMode); + public abstract void Send(TMessage message); public static readonly IMessageSender Empty = new EmptyMessageSender(); @@ -19,7 +19,7 @@ public static IMessageSender Create(TextWriter writer) { if (writer == null) throw new ArgumentNullException(nameof(writer)); - return Empty.WithWrite((obj, transactionMessageMode) => writer.WriteLine(obj)); + return Empty.WithWrite((obj) => writer.WriteLine(obj)); } private class EmptyMessageSender : MessageSender @@ -29,7 +29,7 @@ public EmptyMessageSender() } - public override void Send(TMessage message, TransactionMessageMode transactionMessageMode) + public override void Send(TMessage message) { } @@ -42,10 +42,10 @@ public NotImplementedMessageSender() } - public override void Send(TMessage message, TransactionMessageMode transactionMessageMode) + public override void Send(TMessage message) { throw new NotImplementedException(); } } } -} \ No newline at end of file +} diff --git a/src/Framework.Core/MessageSender/MessageSenderExtensions.cs b/src/Framework.Core/MessageSender/MessageSenderExtensions.cs index 01e71d15a..99c81cc96 100644 --- a/src/Framework.Core/MessageSender/MessageSenderExtensions.cs +++ b/src/Framework.Core/MessageSender/MessageSenderExtensions.cs @@ -10,7 +10,7 @@ public static IMessageSender OverrideInput( if (messageSender == null) throw new ArgumentNullException(nameof(messageSender)); if (selector == null) throw new ArgumentNullException(nameof(selector)); - return new ActionMessageSender((newSource, transactionMode)=> messageSender.Send(selector(newSource), transactionMode)); + return new ActionMessageSender((newSource) => messageSender.Send(selector(newSource))); } @@ -19,13 +19,13 @@ public static IMessageSender WithCatchFault(this IMessageSen { if (messageSender == null) throw new ArgumentNullException(nameof(messageSender)); - return new ActionMessageSender((message, transactionMessageMode) => + return new ActionMessageSender((message) => { if (message == null) throw new ArgumentNullException(nameof(message)); try { - messageSender.Send(message, transactionMessageMode); + messageSender.Send(message); } catch { @@ -34,18 +34,18 @@ public static IMessageSender WithCatchFault(this IMessageSen }); } - public static IMessageSender WithWrite(this IMessageSender messageSender, Action write) + public static IMessageSender WithWrite(this IMessageSender messageSender, Action write) { if (messageSender == null) throw new ArgumentNullException(nameof(messageSender)); if (write == null) throw new ArgumentNullException(nameof(write)); - return new ActionMessageSender((message, transactionMessageMode) => + return new ActionMessageSender((message) => { if (message == null) throw new ArgumentNullException(nameof(message)); - write(message, transactionMessageMode); + write(message); - messageSender.Send(message, transactionMessageMode); + messageSender.Send(message); }); } @@ -53,18 +53,18 @@ public static IMessageSender WithTrace(this IMessageSender System.Diagnostics.Trace.Write( - $"Sending: mode:{transactionMessageMode} message: {message}")); + return messageSender.WithWrite((message) => System.Diagnostics.Trace.Write( + $"Sending: message: {message}")); } private class ActionMessageSender : IMessageSender { - private readonly Action _sendAction; + private readonly Action _sendAction; - public ActionMessageSender(Action sendAction) + public ActionMessageSender(Action sendAction) { if (sendAction == null) throw new ArgumentNullException(nameof(sendAction)); @@ -72,10 +72,10 @@ public ActionMessageSender(Action sendAction) } - public void Send(TMessage message, TransactionMessageMode transactionMessageMode) + public void Send(TMessage message) { - this._sendAction(message, transactionMessageMode); + this._sendAction(message); } } } -} \ No newline at end of file +} diff --git a/src/Framework.Core/MessageSender/TransactionMessageMode.cs b/src/Framework.Core/MessageSender/TransactionMessageMode.cs deleted file mode 100644 index 649697733..000000000 --- a/src/Framework.Core/MessageSender/TransactionMessageMode.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace Framework.Core -{ - /// - /// Константы, определяющие режим отправки сообщений - /// - public enum TransactionMessageMode - { - /// - /// Use internal transaction mode - /// - InternalTransaction, - - /// - /// Use transactionScope - /// - [Obsolete("Please do not use TransactionScope as legacy API")] - DTSTransaction, - - /// - /// If exists transaction scope use DTSTransaction mode else InternalTransaction - /// - Auto, - } -} diff --git a/src/Framework.DomainDriven.WebApiGenerator.NetCore/WebApiNetCoreFileFactoryBase.cs b/src/Framework.DomainDriven.WebApiGenerator.NetCore/WebApiNetCoreFileFactoryBase.cs index 8eaff02ad..f762a9e53 100644 --- a/src/Framework.DomainDriven.WebApiGenerator.NetCore/WebApiNetCoreFileFactoryBase.cs +++ b/src/Framework.DomainDriven.WebApiGenerator.NetCore/WebApiNetCoreFileFactoryBase.cs @@ -38,18 +38,13 @@ protected sealed override CodeTypeDeclaration GetCodeTypeDeclaration() protected sealed override IEnumerable GetBaseTypes() { - var serviceEnvironmentTypeReference = new CodeTypeReference(typeof(IServiceEnvironment<>)) - { - TypeArguments = { this.Configuration.Environment.BLLCore.BLLContextInterfaceTypeReference } - }; var evaluateDataTypeReference = this.GetEvaluateDataTypeReference(); - var result = new CodeTypeReference(typeof(ApiControllerBase<,,>)) + var result = new CodeTypeReference(typeof(ApiControllerBase<,>)) { TypeArguments = { - serviceEnvironmentTypeReference, this.Configuration.Environment.BLLCore.BLLContextInterfaceTypeReference, evaluateDataTypeReference } @@ -58,45 +53,6 @@ protected sealed override IEnumerable GetBaseTypes() yield return result; } - protected sealed override IEnumerable GetConstructors() - { - var baseTypeReference = this.GetBaseTypes().First(); - - var minParameters = new[] - { - new CodeParameterDeclarationExpression(baseTypeReference.TypeArguments[0], "serviceEnvironment"), - new CodeParameterDeclarationExpression(typeof(Framework.Exceptions.IExceptionProcessor), "exceptionProcessor") - }; - - var parametersCollection = new[] - { - minParameters, - ////minParameters - //// .Concat( - //// new[] - //// { - //// new CodeParameterDeclarationExpression( - //// typeof(string), - //// "principalName") - //// }) - //// .ToArray() - }; - - foreach (var parameters in parametersCollection) - { - var result = new CodeConstructor - { - Attributes = MemberAttributes.Public - }; - - result.Parameters.AddRange(parameters); - - result.BaseConstructorArgs.AddRange(parameters.Select(z => z.ToVariableReferenceExpression()).ToArray()); - - yield return result; - } - } - protected override IEnumerable GetMembers() => base.GetMembers().Concat(new[] { this.GetOverrideMethod() }); /// diff --git a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`1.cs b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`1.cs new file mode 100644 index 000000000..d80265499 --- /dev/null +++ b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`1.cs @@ -0,0 +1,33 @@ +using System; + +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.BLL.Configuration; +using Framework.DomainDriven.BLL.Security; + +using Microsoft.AspNetCore.Mvc; + +namespace Framework.DomainDriven.WebApiNetCore +{ + /// + /// Class ApiControllerBase. + /// + /// The type of the TBLL context. + public abstract class ApiControllerBase : ControllerBase, IApiControllerBase + where TBLLContext : class, IConfigurationBLLContextContainer, + IAuthorizationBLLContextContainer + { + public abstract IServiceProvider ServiceProvider { get; set; } + + /// + /// Open DB Session and run Action with pass BLLContext to him + /// + [NonAction] + public abstract void EvaluateC(DBSessionMode sessionMode, Action action); + + /// + /// Open DB Session and run Func with pass BLLContext to him + /// + [NonAction] + public abstract TResult EvaluateC(DBSessionMode sessionMode, Func getResult); + } +} diff --git a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`2.cs b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`2.cs index ee35274e9..8303cbb74 100644 --- a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`2.cs +++ b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`2.cs @@ -1,4 +1,5 @@ using System; +using System.Security.Cryptography; using Framework.DomainDriven.BLL; using Framework.DomainDriven.BLL.Configuration; @@ -6,52 +7,146 @@ using Framework.DomainDriven.ServiceModel.Service; using Framework.Exceptions; +using JetBrains.Annotations; + using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; namespace Framework.DomainDriven.WebApiNetCore { /// - /// Class ApiControllerBase. + /// Class ApiControllerBase. /// /// The type of the t service environment. /// The type of the TBLL context. - public abstract class ApiControllerBase : ControllerBase, IApiControllerBase - where TServiceEnvironment : class, IServiceEnvironment - where TBLLContext : class, IConfigurationBLLContextContainer, - IAuthorizationBLLContextContainer + /// The type of the t evaluated data. + /// + public abstract class ApiControllerBase : ApiControllerBase + where TBLLContext : class, IConfigurationBLLContextContainer, IAuthorizationBLLContextContainer + where TEvaluatedData : EvaluatedData { - protected ApiControllerBase( - TServiceEnvironment serviceEnvironment, - IExceptionProcessor exceptionProcessor) + private IServiceProvider serviceProvider; + + private bool evaluateInvoked; + + public override IServiceProvider ServiceProvider { - this.ServiceEnvironment = serviceEnvironment ?? throw new ArgumentNullException(nameof(serviceEnvironment)); + get { return this.serviceProvider ?? this.HttpContext?.RequestServices; } + set { this.serviceProvider = value; } + } - this.ExceptionProcessor = exceptionProcessor ?? throw new ArgumentNullException(nameof(exceptionProcessor)); + /// + [NonAction] + public sealed override void EvaluateC(DBSessionMode sessionMode, Action action) + { + this.Evaluate(sessionMode, data => action(data.Context)); } + /// + [NonAction] + public sealed override TResult EvaluateC(DBSessionMode sessionMode, Func getResult) + { + return this.Evaluate(sessionMode, data => getResult(data.Context)); + } - public abstract IServiceProvider ServiceProvider { get; set; } + /// + /// Open DB Session and run action + /// + [NonAction] + public void Evaluate(DBSessionMode sessionMode, Action action) + { + if (action == null) + { + throw new ArgumentNullException(nameof(action)); + } + + this.Evaluate(sessionMode, data => + { + action(data); + return default(object); + }); + } /// - /// Default Exception processor + /// Open DB Session and run Func /// - protected IExceptionProcessor ExceptionProcessor { get; } + [NonAction] + public TResult Evaluate(DBSessionMode sessionMode, Func getResult) + { + if (this.evaluateInvoked) + { + throw new Exception("Allowed single evaluate. For multiply session DON'T use this method. Use IContextEvaluator<,>"); + } + + this.evaluateInvoked = true; + + if (sessionMode == DBSessionMode.Read) + { + this.ServiceProvider.GetRequiredService().AsReadOnly(); + } + + return getResult(this.ServiceProvider.GetRequiredService()); + } /// - /// Current ServiceEnvironment + /// Open DB Session and run action for only Read operations /// - public TServiceEnvironment ServiceEnvironment { get; } + [NonAction] + public void EvaluateRead([NotNull] Action action) + { + if (action == null) + { + throw new ArgumentNullException(nameof(action)); + } + + this.Evaluate(DBSessionMode.Read, action); + } + + /// + /// Open DB Session and run action for only Read operations + /// + [NonAction] + public TResult EvaluateRead([NotNull] Func getResult) + { + if (getResult == null) + { + throw new ArgumentNullException(nameof(getResult)); + } + + return this.Evaluate(DBSessionMode.Read, getResult); + } /// - /// Open DB Session and run Action with pass BLLContext to him + /// Open DB Session and run action for only Read/Write operations /// [NonAction] - public abstract void EvaluateC(DBSessionMode sessionMode, Action action); + public void EvaluateWrite([NotNull] Action action) + { + if (action == null) + { + throw new ArgumentNullException(nameof(action)); + } + + this.Evaluate(DBSessionMode.Write, action); + } /// - /// Open DB Session and run Func with pass BLLContext to him + /// Open DB Session and run action for only Read/Write operations /// [NonAction] - public abstract TResult EvaluateC(DBSessionMode sessionMode, Func getResult); + public TResult EvaluateWrite([NotNull] Func getResult) + { + if (getResult == null) + { + throw new ArgumentNullException(nameof(getResult)); + } + + return this.Evaluate(DBSessionMode.Write, getResult); + } + + /// + /// Get Data for Evaluate + /// + protected abstract TEvaluatedData GetEvaluatedData(IDBSession session, TBLLContext context); } } diff --git a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`3.cs b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`3.cs deleted file mode 100644 index 8820746e9..000000000 --- a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerBase`3.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System; -using System.Security.Cryptography; - -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Configuration; -using Framework.DomainDriven.BLL.Security; -using Framework.DomainDriven.ServiceModel.Service; -using Framework.Exceptions; - -using JetBrains.Annotations; - -using Microsoft.AspNetCore.Mvc; - -namespace Framework.DomainDriven.WebApiNetCore -{ - /// - /// Class ApiControllerBase. - /// - /// The type of the t service environment. - /// The type of the TBLL context. - /// The type of the t evaluated data. - /// - public abstract class ApiControllerBase : ApiControllerBase - where TServiceEnvironment : class, IServiceEnvironment - where TBLLContext : class, IConfigurationBLLContextContainer, IAuthorizationBLLContextContainer - where TEvaluatedData : EvaluatedData - { - private IServiceProvider serviceProvider; - - protected ApiControllerBase(TServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) - { - } - - public override IServiceProvider ServiceProvider - { - get { return this.serviceProvider ?? this.HttpContext?.RequestServices; } - set { this.serviceProvider = value; } - } - - /// - [NonAction] - public sealed override void EvaluateC(DBSessionMode sessionMode, Action action) - { - this.Evaluate(sessionMode, data => action(data.Context)); - } - - /// - [NonAction] - public sealed override TResult EvaluateC(DBSessionMode sessionMode, Func getResult) - { - return this.Evaluate(sessionMode, data => getResult(data.Context)); - } - - /// - /// Open DB Session and run action - /// - [NonAction] - public void Evaluate(DBSessionMode sessionMode, Action action) - { - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } - - this.Evaluate(sessionMode, data => - { - action(data); - return default(object); - }); - } - - /// - /// Open DB Session and run Func - /// - [NonAction] - public TResult Evaluate(DBSessionMode sessionMode, Func getResult) - { - if (getResult == null) - { - throw new ArgumentNullException(nameof(getResult)); - } - - try - { - return this.ServiceEnvironment.GetContextEvaluator(this.ServiceProvider) - .Evaluate( - sessionMode, - (context, session) => - { - try - { - return getResult(this.GetEvaluatedData(session, context)); - } - catch (Exception baseException) - { - var expandedBaseException = - context.Configuration.ExceptionService.Process(baseException, true); - - throw new EvaluateException(baseException, expandedBaseException); - } - }); - } - catch (Exception exception) - { - var raiseException = this.GetFacadeException(exception); - - if (raiseException == exception) - { - throw; - } - - throw raiseException; - } - } - - /// - /// Open DB Session and run action for only Read operations - /// - [NonAction] - public void EvaluateRead([NotNull] Action action) - { - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } - - this.Evaluate(DBSessionMode.Read, action); - } - - /// - /// Open DB Session and run action for only Read operations - /// - [NonAction] - public TResult EvaluateRead([NotNull] Func getResult) - { - if (getResult == null) - { - throw new ArgumentNullException(nameof(getResult)); - } - - return this.Evaluate(DBSessionMode.Read, getResult); - } - - /// - /// Open DB Session and run action for only Read/Write operations - /// - [NonAction] - public void EvaluateWrite([NotNull] Action action) - { - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } - - this.Evaluate(DBSessionMode.Write, action); - } - - /// - /// Open DB Session and run action for only Read/Write operations - /// - [NonAction] - public TResult EvaluateWrite([NotNull] Func getResult) - { - if (getResult == null) - { - throw new ArgumentNullException(nameof(getResult)); - } - - return this.Evaluate(DBSessionMode.Write, getResult); - } - - /// - /// Get Data for Evaluate - /// - protected abstract TEvaluatedData GetEvaluatedData(IDBSession session, TBLLContext context); - - private Exception GetFacadeException(Exception exception) - { - try - { - return this.ExceptionProcessor.Process(exception); - } - catch (Exception) - { - return new InternalServerException(); - } - } - } -} diff --git a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerExceptionService.cs b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerExceptionService.cs index cad71608c..60de28f88 100644 --- a/src/Framework.DomainDriven.WebApiNetCore/ApiControllerExceptionService.cs +++ b/src/Framework.DomainDriven.WebApiNetCore/ApiControllerExceptionService.cs @@ -12,22 +12,20 @@ namespace Framework.DomainDriven.WebApiNetCore { /// - public class ApiControllerExceptionService : IExceptionProcessor + public class ApiControllerExceptionService : IExceptionProcessor where TBLLContext : class, IConfigurationBLLContextContainer - where TServiceEnvironment : IServiceEnvironment { - private readonly TServiceEnvironment serviceEnvironment; + private readonly IContextEvaluator contextEvaluator; + + private readonly IDebugModeManager debugModeManager; public ApiControllerExceptionService( - [NotNull] TServiceEnvironment serviceEnvironment, - bool expandDetailException = true) + [NotNull] IContextEvaluator contextEvaluator, + IDebugModeManager debugModeManager = null, + bool expandDetailException = true) { - if (serviceEnvironment == null) - { - throw new ArgumentNullException(nameof(serviceEnvironment)); - } - - this.serviceEnvironment = serviceEnvironment; + this.contextEvaluator = contextEvaluator ?? throw new ArgumentNullException(nameof(contextEvaluator)); + this.debugModeManager = debugModeManager; this.ExpandDetailException = expandDetailException; } @@ -39,19 +37,7 @@ public ApiControllerExceptionService( /// public Exception Process(Exception exception) => - this.serviceEnvironment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => this.Process(exception, context)); - - /// - /// Safe Send To Mail Exception - /// - protected virtual void SafeSendToMailException(Exception baseException, TBLLContext context) - { - var tryMethod = new TryMethod(this.TrySendToMailException); - - Maybe.OfTryMethod(tryMethod)(baseException, context) - .ToReference() - .Maybe(z => this.TrySaveExceptionMessage(z, context)); - } + this.contextEvaluator.Evaluate(DBSessionMode.Write, context => this.Process(exception, context)); /// /// Is Handled Exception @@ -91,7 +77,7 @@ private Exception Process(Exception exception, TBLLContext context) this.Save(expandedBaseException, context); - if (!this.serviceEnvironment.IsDebugMode) + if (!this.debugModeManager.Maybe(v => v.IsDebugMode)) { return this.GetFacadeException(expandedBaseException, context); } @@ -123,8 +109,6 @@ private void Save([NotNull] Exception exception, TBLLContext context) } this.TrySaveExceptionMessage(exception, context); - - this.SafeSendToMailException(exception, context); } private Exception GetFacadeException(Exception exception, TBLLContext context) @@ -139,27 +123,6 @@ private Exception GetFacadeException(Exception exception, TBLLContext context) : this.GetInternalServerException(); } - private bool TrySendToMailException( - Exception baseException, - TBLLContext context, - out Exception faultSendException) - { - try - { - context.Configuration.ExceptionSender.Send(baseException, TransactionMessageMode.InternalTransaction); - - faultSendException = null; - - return true; - } - catch (Exception ex) - { - faultSendException = ex; - - return false; - } - } - private void TrySaveExceptionMessage(Exception exception, TBLLContext context) { if (exception == null) @@ -171,9 +134,8 @@ private void TrySaveExceptionMessage(Exception exception, TBLLContext context) { context.Configuration.ExceptionService.Save(exception); } - catch (Exception ex) + catch { - this.SafeSendToMailException(ex, context); } } } diff --git a/src/Framework.DomainDriven.WebApiNetCore/Integration/IntegrationSchemaControllerBase.cs b/src/Framework.DomainDriven.WebApiNetCore/Integration/IntegrationSchemaControllerBase.cs index d89f31448..a73817a8b 100644 --- a/src/Framework.DomainDriven.WebApiNetCore/Integration/IntegrationSchemaControllerBase.cs +++ b/src/Framework.DomainDriven.WebApiNetCore/Integration/IntegrationSchemaControllerBase.cs @@ -6,20 +6,24 @@ using Framework.DomainDriven.BLL.Security; using Framework.DomainDriven.ServiceModel.Service; using Framework.Exceptions; + +using JetBrains.Annotations; + using Microsoft.AspNetCore.Mvc; namespace Framework.DomainDriven.WebApiNetCore.Integration { - public abstract class IntegrationSchemaControllerBase : ApiControllerBase - where TServiceEnvironment : class, IServiceEnvironment - where TBLLContext : class, IConfigurationBLLContextContainer, IAuthorizationBLLContextContainer, IDateTimeServiceContainer + public abstract class IntegrationSchemaControllerBase : ApiControllerBase + where TBLLContext : class, IConfigurationBLLContextContainer, IAuthorizationBLLContextContainer where TEvaluatedData : EvaluatedData { + private readonly IDateTimeService dateTimeService; + private const string AuthIntegrationNamespace = "http://authorization.luxoft.com/IntegrationEvent"; - protected IntegrationSchemaControllerBase(TServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + protected IntegrationSchemaControllerBase([NotNull] IDateTimeService dateTimeService) { + this.dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); } [HttpGet] @@ -39,7 +43,7 @@ private IActionResult DownloadKnownTypesWsdl(string xsdNamespace, IEnumerable builder.UseMiddleware(); +} diff --git a/src/Framework.DomainDriven.WebApiNetCore/Middleware/TryProcessDbSessionMiddleware.cs b/src/Framework.DomainDriven.WebApiNetCore/Middleware/TryProcessDbSessionMiddleware.cs new file mode 100644 index 000000000..73b9f6895 --- /dev/null +++ b/src/Framework.DomainDriven.WebApiNetCore/Middleware/TryProcessDbSessionMiddleware.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading.Tasks; + +using Framework.DomainDriven.BLL; + +using Microsoft.AspNetCore.Http; + +namespace Framework.DomainDriven.WebApiNetCore; + +public sealed class TryProcessDbSessionMiddleware +{ + private readonly RequestDelegate next; + + public TryProcessDbSessionMiddleware(RequestDelegate next) + { + this.next = next; + } + + public Task Invoke(HttpContext context, IServiceProvider serviceProvider) + { + + try + { + return this.next(context); + } + catch + { + serviceProvider.TryFaultDbSession(); + throw; + } + finally + { + serviceProvider.TryCloseDbSession(); + } + } +} diff --git a/src/Framework.ExpressionParsers.Tests.Unit/Framework.ExpressionParsers.Tests.Unit.csproj b/src/Framework.ExpressionParsers.Tests.Unit/Framework.ExpressionParsers.Tests.Unit.csproj index b5c9fdcf6..23912c70c 100644 --- a/src/Framework.ExpressionParsers.Tests.Unit/Framework.ExpressionParsers.Tests.Unit.csproj +++ b/src/Framework.ExpressionParsers.Tests.Unit/Framework.ExpressionParsers.Tests.Unit.csproj @@ -3,9 +3,9 @@ false - - - + + + diff --git a/src/Framework.ExpressionParsers/Framework.ExpressionParsers.csproj b/src/Framework.ExpressionParsers/Framework.ExpressionParsers.csproj index 153c872e8..576fa09dd 100644 --- a/src/Framework.ExpressionParsers/Framework.ExpressionParsers.csproj +++ b/src/Framework.ExpressionParsers/Framework.ExpressionParsers.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Framework.HangfireCore/Framework.HangfireCore.csproj b/src/Framework.HangfireCore/Framework.HangfireCore.csproj index 13a4f5679..15a8d4ce5 100644 --- a/src/Framework.HangfireCore/Framework.HangfireCore.csproj +++ b/src/Framework.HangfireCore/Framework.HangfireCore.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/src/Framework.HierarchicalExpand.Abstract/Framework.HierarchicalExpand.Abstract.csproj b/src/Framework.HierarchicalExpand.Abstract/Framework.HierarchicalExpand.Abstract.csproj index 7c89f4740..1a67f15fd 100644 --- a/src/Framework.HierarchicalExpand.Abstract/Framework.HierarchicalExpand.Abstract.csproj +++ b/src/Framework.HierarchicalExpand.Abstract/Framework.HierarchicalExpand.Abstract.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Framework.NotificationCore/Extensions/NotificationSenderExtensions.cs b/src/Framework.NotificationCore/Extensions/NotificationSenderExtensions.cs index d22d75b2a..ee8b434c6 100644 --- a/src/Framework.NotificationCore/Extensions/NotificationSenderExtensions.cs +++ b/src/Framework.NotificationCore/Extensions/NotificationSenderExtensions.cs @@ -1,8 +1,6 @@ using Framework.Core; -using Framework.DomainDriven.BLL; using Framework.DomainDriven.BLL.Configuration; using Framework.DomainDriven.ServiceModel; -using Framework.DomainDriven.ServiceModel.Service; using Framework.Notification.DTO; using Framework.NotificationCore.Jobs; using Framework.NotificationCore.Senders; @@ -10,22 +8,21 @@ using Framework.NotificationCore.Settings; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; + using IConfigurationBLLContext = Framework.Configuration.BLL.IConfigurationBLLContext; namespace Framework.DependencyInjection { public static class NotificationSenderExtensions { - public static void RegisterMessageSenderDependencies( + public static void RegisterMessageSenderDependencies( this IServiceCollection services, IConfiguration configuration) - where TEnvironment : IServiceEnvironment where TBLLContext : IConfigurationBLLContextContainer { services.Configure(configuration.GetSection("SmtpSettings")); services.AddScoped>(); services.AddSingleton, EmptyMessageSender>(); - services.AddSingleton(); } /// diff --git a/src/Framework.NotificationCore/Framework.NotificationCore.csproj b/src/Framework.NotificationCore/Framework.NotificationCore.csproj index 72993b743..cd343040c 100644 --- a/src/Framework.NotificationCore/Framework.NotificationCore.csproj +++ b/src/Framework.NotificationCore/Framework.NotificationCore.csproj @@ -9,14 +9,14 @@ - - + + - + diff --git a/src/Framework.NotificationCore/Jobs/SendNotificationsJob.cs b/src/Framework.NotificationCore/Jobs/SendNotificationsJob.cs index 2ad81961e..e56411250 100644 --- a/src/Framework.NotificationCore/Jobs/SendNotificationsJob.cs +++ b/src/Framework.NotificationCore/Jobs/SendNotificationsJob.cs @@ -7,8 +7,6 @@ using JetBrains.Annotations; -using Microsoft.Extensions.DependencyInjection; - using IConfigurationBLLContext = Framework.Configuration.BLL.IConfigurationBLLContext; namespace Framework.NotificationCore.Jobs @@ -16,25 +14,21 @@ namespace Framework.NotificationCore.Jobs public class SendNotificationsJob : ISendNotificationsJob where TBLLContext: IConfigurationBLLContextContainer { - private readonly IServiceEnvironment serviceEnvironment; + private readonly IContextEvaluator contextEvaluator; private readonly IExceptionProcessor exceptionProcessor; - private readonly IServiceProvider serviceProvider; - public SendNotificationsJob( - [NotNull] IServiceEnvironment serviceEnvironment, - [NotNull] IExceptionProcessor exceptionProcessor, - [NotNull] IServiceProvider serviceProvider) + [NotNull] IContextEvaluator contextEvaluator, + [NotNull] IExceptionProcessor exceptionProcessor) { - this.serviceEnvironment = serviceEnvironment ?? throw new ArgumentNullException(nameof(serviceEnvironment)); + this.contextEvaluator = contextEvaluator ?? throw new ArgumentNullException(nameof(contextEvaluator)); this.exceptionProcessor = exceptionProcessor ?? throw new ArgumentNullException(nameof(exceptionProcessor)); - this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); } public void Send() { - var result = this.serviceEnvironment.GetContextEvaluator(this.serviceProvider).Evaluate( + var result = this.contextEvaluator.Evaluate( DBSessionMode.Write, // todo: нужен рефакторинг - хотим разделить создание и отправку нотификаций, а то сейчас всё в кучу свалено z => diff --git a/src/Framework.NotificationCore/Monitoring/AdminHangfireAuthorization.cs b/src/Framework.NotificationCore/Monitoring/AdminHangfireAuthorization.cs index ae25fef02..5d13fcf2b 100644 --- a/src/Framework.NotificationCore/Monitoring/AdminHangfireAuthorization.cs +++ b/src/Framework.NotificationCore/Monitoring/AdminHangfireAuthorization.cs @@ -12,9 +12,9 @@ namespace Framework.NotificationCore.Monitoring; public class AdminHangfireAuthorization : IDashboardAuthorizationFilter where TBllContext : IAuthorizationBLLContextContainer { - private readonly Lazy> environment; + private readonly IContextEvaluator contextEvaluator; - public AdminHangfireAuthorization(Lazy> environment) => this.environment = environment; + public AdminHangfireAuthorization(IContextEvaluator contextEvaluator) => this.contextEvaluator = contextEvaluator; public bool Authorize(DashboardContext context) { @@ -25,10 +25,6 @@ public bool Authorize(DashboardContext context) return false; } - return this.environment.Value - .GetContextEvaluator() - .Evaluate( - DBSessionMode.Read, - z => z.Authorization.Logics.BusinessRole.HasAdminRole()); + return this.contextEvaluator.Evaluate(DBSessionMode.Read, z => z.Authorization.Logics.BusinessRole.HasAdminRole()); } } diff --git a/src/Framework.NotificationCore/Senders/EmptyMessageSender.cs b/src/Framework.NotificationCore/Senders/EmptyMessageSender.cs index 66d3149e4..6ce8f8e53 100644 --- a/src/Framework.NotificationCore/Senders/EmptyMessageSender.cs +++ b/src/Framework.NotificationCore/Senders/EmptyMessageSender.cs @@ -5,7 +5,7 @@ namespace Framework.NotificationCore.Senders { public class EmptyMessageSender : IMessageSender { - public void Send(NotificationEventDTO message, TransactionMessageMode sendMessageMode = TransactionMessageMode.Auto) + public void Send(NotificationEventDTO message) { } } diff --git a/src/Framework.NotificationCore/Senders/NotificationContext.cs b/src/Framework.NotificationCore/Senders/NotificationContext.cs deleted file mode 100644 index 9483c2eb5..000000000 --- a/src/Framework.NotificationCore/Senders/NotificationContext.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Net.Mail; -using Framework.Core; -using Framework.Notification.DTO; - -namespace Framework.NotificationCore.Senders -{ - /// - /// заглушка для совместимости со старыми способами отправки нотификаций - /// - public class NotificationContext : DomainDriven.ServiceModel.NotificationContext - { - public NotificationContext(IMessageSender notificationMessageSender) - : base(notificationMessageSender, new MailAddress("Fake@Fake.com", "Fake"), "Fake@Fake.com") - { - } - } -} diff --git a/src/Framework.NotificationCore/Senders/SmtpMessageSender.cs b/src/Framework.NotificationCore/Senders/SmtpMessageSender.cs index 6f0564243..c9859f44d 100644 --- a/src/Framework.NotificationCore/Senders/SmtpMessageSender.cs +++ b/src/Framework.NotificationCore/Senders/SmtpMessageSender.cs @@ -49,7 +49,7 @@ private ISmtpMessageSender GetSender() protected virtual bool IsProduction() => Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == Environments.Production; - public void Send(NotificationEventDTO message, TransactionMessageMode sendMessageMode = TransactionMessageMode.Auto) + public void Send(NotificationEventDTO message) { using (var client = this.GetSmtpClient()) { diff --git a/src/Framework.OData.Tests.Unit/Framework.OData.Tests.Unit.csproj b/src/Framework.OData.Tests.Unit/Framework.OData.Tests.Unit.csproj index c650a0a9b..4979154c6 100644 --- a/src/Framework.OData.Tests.Unit/Framework.OData.Tests.Unit.csproj +++ b/src/Framework.OData.Tests.Unit/Framework.OData.Tests.Unit.csproj @@ -3,9 +3,9 @@ false - - - + + + diff --git a/src/Framework.Security.Cryptography/ICryptProvider.cs b/src/Framework.Security.Cryptography/ICryptProvider.cs index 715ae17d8..1ae31e8cd 100644 --- a/src/Framework.Security.Cryptography/ICryptProvider.cs +++ b/src/Framework.Security.Cryptography/ICryptProvider.cs @@ -2,9 +2,6 @@ namespace Framework.Security.Cryptography { - //[ComVisible(true)] - //[Guid("A72453A1-68E7-47B9-8601-28A5778B655F")] - //[InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface ICryptProvider { byte[] Encrypt(byte[] data); diff --git a/src/Framework.Security.Cryptography/ICryptService.cs b/src/Framework.Security.Cryptography/ICryptService.cs index 282c153cb..3bccb6fee 100644 --- a/src/Framework.Security.Cryptography/ICryptService.cs +++ b/src/Framework.Security.Cryptography/ICryptService.cs @@ -3,9 +3,6 @@ namespace Framework.Security.Cryptography { - //[ComVisible(true)] - //[Guid("C4E94923-D231-4EB5-8DD3-8A0E3679D9F9")] - //[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] public interface ICryptService { ICryptProvider GetCryptProvider(string certName, string symmetricAlgorithmName); @@ -15,4 +12,4 @@ public interface ICryptService { ICryptProvider GetCryptProvider(TSystem system); } -} \ No newline at end of file +} diff --git a/src/Framework.SecuritySystem.DiTests/Framework.SecuritySystem.DiTests.csproj b/src/Framework.SecuritySystem.DiTests/Framework.SecuritySystem.DiTests.csproj index 8cdff710d..725c31039 100644 --- a/src/Framework.SecuritySystem.DiTests/Framework.SecuritySystem.DiTests.csproj +++ b/src/Framework.SecuritySystem.DiTests/Framework.SecuritySystem.DiTests.csproj @@ -9,12 +9,12 @@ - + - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Framework.UnitTesting/Framework.UnitTesting.csproj b/src/Framework.UnitTesting/Framework.UnitTesting.csproj index 533845d32..1b29972e8 100644 --- a/src/Framework.UnitTesting/Framework.UnitTesting.csproj +++ b/src/Framework.UnitTesting/Framework.UnitTesting.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Framework.Validation.Tests.Unit/Framework.Validation.Tests.Unit.csproj b/src/Framework.Validation.Tests.Unit/Framework.Validation.Tests.Unit.csproj index bbf22df73..66235051c 100644 --- a/src/Framework.Validation.Tests.Unit/Framework.Validation.Tests.Unit.csproj +++ b/src/Framework.Validation.Tests.Unit/Framework.Validation.Tests.Unit.csproj @@ -4,10 +4,10 @@ - - - - + + + + diff --git a/src/Framework.WebApi.Utils/Framework.WebApi.Utils.csproj b/src/Framework.WebApi.Utils/Framework.WebApi.Utils.csproj index cc1929a87..442fd3d65 100644 --- a/src/Framework.WebApi.Utils/Framework.WebApi.Utils.csproj +++ b/src/Framework.WebApi.Utils/Framework.WebApi.Utils.csproj @@ -9,13 +9,13 @@ - + - - - - + + + + diff --git a/src/SampleSystem.WebApiCore/js/generated/facade/facade.generated.ts b/src/SampleSystem.WebApiCore/js/generated/facade/facade.generated.ts index 9d8407497..b99269df3 100644 --- a/src/SampleSystem.WebApiCore/js/generated/facade/facade.generated.ts +++ b/src/SampleSystem.WebApiCore/js/generated/facade/facade.generated.ts @@ -18,6 +18,8 @@ import { Core } from 'luxite/framework/framework'; import * as dto from '../dto/entities.generated'; import * as persistent from '../../app/common/HierarchicalNode'; +export let asyncGetLocationsAsyncFunc = _asyncGetLocations(); +export let asyncSaveLocationAsyncFunc = _asyncSaveLocation(); export let changeEmployeeByComplexAsyncFunc = _changeEmployeeByComplex(); export let changeEmployeeByEmailAsyncFunc = _changeEmployeeByEmail(); export let checkBusinessUnitAccessAsyncFunc = _checkBusinessUnitAccess(); @@ -592,14 +594,30 @@ export let testPeriodAsyncFunc = _testPeriod(); export let updateEmployeeAsyncFunc = _updateEmployee(); export let updateExample1AsyncFunc = _updateExample1(); -function _changeEmployeeByComplex(): async.AsyncFunc3 { - return new async.AsyncFunc3((employeeChangeModel: dto.EmployeeComplexChangeModelStrictDTO) => { - let baseParameters = employeeChangeModel.toNativeJson(); - let service = Environment.current.context.facadeFactory.createService(); - return service.getData('Employee/ChangeEmployeeByComplex', {plain : dto.EmployeeIdentityDTO, observable : dto.EmployeeObservableIdentityDTO}, baseParameters); +function _asyncGetLocations(): async.AsyncFunc3>, Task>, dto.LocationSimpleDTO, dto.LocationObservableSimpleDTO> { + return new async.AsyncFunc3((cancellationToken: CancellationToken) => { + let baseParameters = cancellationToken; + let service = Environment.current.context.facadeFactory.createService>, Task>, dto.LocationSimpleDTO, dto.LocationObservableSimpleDTO>(); + return service.getData('TestAsync/AsyncGetLocations', {plain : dto.LocationSimpleDTO, observable : dto.LocationObservableSimpleDTO}, baseParameters); }); } + function _asyncSaveLocation(): async.AsyncFunc4, Task, dto.LocationIdentityDTO, dto.LocationObservableIdentityDTO> { + return new async.AsyncFunc4((businessUnitStrictDTO: dto.LocationStrictDTO, cancellationToken: CancellationToken) => { + let baseParameters = {businessUnitStrictDTO : businessUnitStrictDTO.toNativeJson(), cancellationToken : cancellationToken}; + let service = Environment.current.context.facadeFactory.createService, Task, dto.LocationIdentityDTO, dto.LocationObservableIdentityDTO>(); + return service.getData('TestAsync/AsyncSaveLocation', {plain : dto.LocationIdentityDTO, observable : dto.LocationObservableIdentityDTO}, baseParameters); + }); + } + + function _changeEmployeeByComplex(): async.AsyncFunc3 { + return new async.AsyncFunc3((employeeChangeModel: dto.EmployeeComplexChangeModelStrictDTO) => { + let baseParameters = employeeChangeModel.toNativeJson(); + let service = Environment.current.context.facadeFactory.createService(); + return service.getData('Employee/ChangeEmployeeByComplex', {plain : dto.EmployeeIdentityDTO, observable : dto.EmployeeObservableIdentityDTO}, baseParameters); + }); + } + function _changeEmployeeByEmail(): async.AsyncFunc3 { return new async.AsyncFunc3((employeeChangeModel: dto.EmployeeEmailChangeModelStrictDTO) => { let baseParameters = employeeChangeModel.toNativeJson(); diff --git a/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CalcHasAccessStep.cs b/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CalcHasAccessStep.cs index 5471d922a..c364a9a8b 100644 --- a/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CalcHasAccessStep.cs +++ b/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CalcHasAccessStep.cs @@ -15,7 +15,7 @@ public class CalcHasAccessStep : WaitFor { private readonly IContextEvaluator contextEvaluator; - public CalcHasAccessStep([NotNull] IScopedContextEvaluator contextEvaluator) + public CalcHasAccessStep([NotNull] IContextEvaluator contextEvaluator) { this.contextEvaluator = contextEvaluator ?? throw new ArgumentNullException(nameof(contextEvaluator)); } diff --git a/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CanAutoApproveStep.cs b/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CanAutoApproveStep.cs index 35a042824..9e26b1206 100644 --- a/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CanAutoApproveStep.cs +++ b/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/CanAutoApproveStep.cs @@ -13,15 +13,21 @@ namespace Framework.Authorization.ApproveWorkflow; public class CanAutoApproveStep : IStepBody { - private readonly IContextEvaluator contextEvaluator; + private readonly IAuthorizationBLLContext context; private readonly IWorkflowApproveProcessor workflowApproveProcessor; - public CanAutoApproveStep([NotNull] IScopedContextEvaluator contextEvaluator, - [NotNull] IWorkflowApproveProcessor workflowApproveProcessor) + private readonly IDBSession dbSession; + + public CanAutoApproveStep([NotNull] IAuthorizationBLLContext context, + [NotNull] IWorkflowApproveProcessor workflowApproveProcessor, + IDBSession dbSession) { - this.contextEvaluator = contextEvaluator ?? throw new ArgumentNullException(nameof(contextEvaluator)); + this.context = context ?? throw new ArgumentNullException(nameof(context)); this.workflowApproveProcessor = workflowApproveProcessor ?? throw new ArgumentNullException(nameof(workflowApproveProcessor)); + + this.dbSession = dbSession; + this.dbSession.AsReadOnly(); } public async Task RunAsync(IStepExecutionContext context) @@ -35,13 +41,10 @@ public async Task RunAsync(IStepExecutionContext context) private bool CanAutoApprove(ApproveOperationWorkflowObject workflowObject) { - return this.contextEvaluator.Evaluate(DBSessionMode.Read, ctx => - { - var permission = ctx.Logics.Permission.GetById(workflowObject.PermissionId, true); + var permission = this.context.Logics.Permission.GetById(workflowObject.PermissionId, true); - var operation = ctx.Logics.Operation.GetById(workflowObject.OperationId, true); + var operation = this.context.Logics.Operation.GetById(workflowObject.OperationId, true); - return this.workflowApproveProcessor.CanAutoApprove(permission, operation); - }); + return this.workflowApproveProcessor.CanAutoApprove(permission, operation); } } diff --git a/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/SetPermissionStatusStep.cs b/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/SetPermissionStatusStep.cs index b72f07afd..dbcf828b8 100644 --- a/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/SetPermissionStatusStep.cs +++ b/src/_Authorization/Framework.Authorization.ApproveWorkflow/CustomSteps/SetPermissionStatusStep.cs @@ -16,7 +16,7 @@ public class SetPermissionStatusStep : IStepBody [NotNull] private readonly IContextEvaluator contextEvaluator; - public SetPermissionStatusStep([NotNull] IScopedContextEvaluator contextEvaluator) + public SetPermissionStatusStep([NotNull] IContextEvaluator contextEvaluator) { this.contextEvaluator = contextEvaluator; } @@ -27,7 +27,7 @@ public async Task RunAsync(IStepExecutionContext context) { var wfObj = (ApprovePermissionWorkflowObject)context.Workflow.Data; - this.contextEvaluator.Evaluate(DBSessionMode.Write, ctx => + this.contextEvaluator.Evaluate (DBSessionMode.Write, ctx => { var permission = ctx.Logics.Permission.GetById(wfObj.PermissionId, true); diff --git a/src/_Authorization/Framework.Authorization.ApproveWorkflow/Framework.Authorization.ApproveWorkflow.csproj b/src/_Authorization/Framework.Authorization.ApproveWorkflow/Framework.Authorization.ApproveWorkflow.csproj index a54a947af..c41d32968 100644 --- a/src/_Authorization/Framework.Authorization.ApproveWorkflow/Framework.Authorization.ApproveWorkflow.csproj +++ b/src/_Authorization/Framework.Authorization.ApproveWorkflow/Framework.Authorization.ApproveWorkflow.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContext.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContext.cs index a1d1ac99c..23e88ae6e 100644 --- a/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContext.cs +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContext.cs @@ -15,9 +15,7 @@ using Framework.HierarchicalExpand; using Framework.Projection; using Framework.QueryLanguage; -using Framework.Security; using Framework.SecuritySystem; -using Framework.Validation; using JetBrains.Annotations; @@ -31,26 +29,21 @@ public partial class AuthorizationBLLContext private readonly Lazy lazySettings; - private readonly Func impersonateFunc; - private readonly IDictionaryCache entityTypeByNameCache; private readonly IDictionaryCache entityTypeByIdCache; private readonly ISecurityProvider operationSecurityProvider; - private static readonly ITypeResolver CurrentTargetSystemTypeResolver = - TypeSource.FromSample().ToDefaultTypeResolver(); - public AuthorizationBLLContext( [NotNull] IServiceProvider serviceProvider, [NotNull] IDALFactory dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IAccessDeniedExceptionService accessDeniedExceptionService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, - [NotNull] IValidator validator, + [NotNull] IAuthorizationValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, [NotNull] IFetchService fetchService, [NotNull] IDateTimeService dateTimeService, @@ -61,35 +54,33 @@ public AuthorizationBLLContext( [NotNull] IAuthorizationBLLFactoryContainer logics, [NotNull] IAuthorizationExternalSource externalSource, [NotNull] IRunAsManager runAsManager, - [NotNull] Func impersonateFunc, - [NotNull] ITypeResolver securityTypeResolver) + [NotNull] ISecurityTypeResolverContainer securityTypeResolverContainer, + [NotNull] IAuthorizationBLLContextSettings settings) : base( serviceProvider, dalFactory, - operationListeners, + operationSenders, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, - fetchService, - dateTimeService) + fetchService) { + this.DateTimeService = dateTimeService; this.SecurityExpressionBuilderFactory = securityExpressionBuilderFactory ?? throw new ArgumentNullException(nameof(securityExpressionBuilderFactory)); this.SecurityService = securityService ?? throw new ArgumentNullException(nameof(securityService)); this.logics = logics ?? throw new ArgumentNullException(nameof(logics)); this.ExternalSource = externalSource ?? throw new ArgumentNullException(nameof(externalSource)); this.RunAsManager = runAsManager ?? throw new ArgumentNullException(nameof(runAsManager)); - - this.impersonateFunc = impersonateFunc ?? throw new ArgumentNullException(nameof(impersonateFunc)); this.Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.lazyCurrentPrincipal = LazyHelper.Create(() => this.Logics.Principal.GetCurrent()); this.CurrentPrincipalName = userAuthenticationService.GetUserName(); - this.SecurityTypeResolver = securityTypeResolver.OverrideInput((EntityType entityType) => entityType.Name); + this.SecurityTypeResolver = securityTypeResolverContainer.SecurityTypeResolver.OverrideInput((EntityType entityType) => entityType.Name); this.lazySettings = LazyHelper.Create(() => this.Logics.Default.Create().GetFullList().ToSettings()); @@ -103,34 +94,34 @@ public AuthorizationBLLContext( .WithLock(); this.operationSecurityProvider = new OperationSecurityProvider(this); + + this.TypeResolver = settings.TypeResolver; } - public IConfigurationBLLContext Configuration { get; private set; } + public IConfigurationBLLContext Configuration { get; } - public ITypeResolver TypeResolver => CurrentTargetSystemTypeResolver; + public ITypeResolver TypeResolver { get; } - public ITypeResolver SecurityTypeResolver { get; private set; } + public ITypeResolver SecurityTypeResolver { get; } - public IRunAsManager RunAsManager { get; private set; } + public IRunAsManager RunAsManager { get; } - public string CurrentPrincipalName { get; private set; } + public string CurrentPrincipalName { get; } - public IAuthorizationSecurityService SecurityService { get; private set; } + public IAuthorizationSecurityService SecurityService { get; } public Settings Settings => this.lazySettings.Value; public override IAuthorizationBLLFactoryContainer Logics => this.logics; - public IAuthorizationExternalSource ExternalSource { get; private set; } + public IAuthorizationExternalSource ExternalSource { get; } public Principal CurrentPrincipal => this.lazyCurrentPrincipal.Value; - public ISecurityExpressionBuilderFactory SecurityExpressionBuilderFactory { get; private set; } + [NotNull] + public IDateTimeService DateTimeService { get; } - public IAuthorizationBLLContext Impersonate(string principalName) - { - return this.impersonateFunc(principalName); - } + public ISecurityExpressionBuilderFactory SecurityExpressionBuilderFactory { get; } public EntityType GetEntityType(Type type) { diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContextSettings.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContextSettings.cs new file mode 100644 index 000000000..8827c69da --- /dev/null +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationBLLContextSettings.cs @@ -0,0 +1,12 @@ +using System; + +using Framework.Core; + +using Framework.Authorization.Domain; + +namespace Framework.Authorization.BLL; + +public class AuthorizationBLLContextSettings : IAuthorizationBLLContextSettings +{ + public ITypeResolver TypeResolver { get; init; } = TypeSource.FromSample().ToDefaultTypeResolver(); +} diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationValidator.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationValidator.cs new file mode 100644 index 000000000..18bda588e --- /dev/null +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationValidator.cs @@ -0,0 +1,5 @@ +namespace Framework.Authorization.BLL; + +public partial class AuthorizationValidator : IAuthorizationValidator +{ +} diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationValidatorCompileCache.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationValidatorCompileCache.cs new file mode 100644 index 000000000..f8ee08b49 --- /dev/null +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/AuthorizationValidatorCompileCache.cs @@ -0,0 +1,18 @@ +using System; + +using Framework.Core; +using Framework.Validation; + +using Framework.DomainDriven.BLL; + +namespace Framework.Authorization.BLL; + +public class AuthorizationValidatorCompileCache : ValidatorCompileCache +{ + public AuthorizationValidatorCompileCache(IAvailableValues availableValues) : + base(availableValues + .ToBLLContextValidationExtendedData() + .Pipe(extendedValidationData => new AuthorizationValidationMap(extendedValidationData))) + { + } +} diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContext.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContext.cs index a92b68792..3086560e2 100644 --- a/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContext.cs +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContext.cs @@ -20,14 +20,12 @@ public partial interface IAuthorizationBLLContext : ITrackingServiceContainer, - IImpersonateObject, - ITypeResolverContainer, - IConfigurationBLLContextContainer, - - IDateTimeServiceContainer + IConfigurationBLLContextContainer { + IDateTimeService DateTimeService { get; } + IAuthorizationExternalSource ExternalSource { get; } Principal CurrentPrincipal { get; } diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContextSettings.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContextSettings.cs new file mode 100644 index 000000000..159ba4ecf --- /dev/null +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationBLLContextSettings.cs @@ -0,0 +1,7 @@ +using Framework.Core; + +namespace Framework.Authorization.BLL; + +public interface IAuthorizationBLLContextSettings : ITypeResolverContainer +{ +} diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationValidator.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationValidator.cs new file mode 100644 index 000000000..d3806304e --- /dev/null +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/IAuthorizationValidator.cs @@ -0,0 +1,7 @@ +using Framework.Validation; + +namespace Framework.Authorization.BLL; + +public interface IAuthorizationValidator : IValidator +{ +} diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Context/ISecurityTypeResolverContainer.cs b/src/_Authorization/Framework.Authorization.BLL.Core/Context/ISecurityTypeResolverContainer.cs new file mode 100644 index 000000000..d63510ae5 --- /dev/null +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Context/ISecurityTypeResolverContainer.cs @@ -0,0 +1,8 @@ +using Framework.Core; + +namespace Framework.Authorization.BLL; + +public interface ISecurityTypeResolverContainer +{ + ITypeResolver SecurityTypeResolver { get; } +} diff --git a/src/_Authorization/Framework.Authorization.BLL.Core/Framework.Authorization.BLL.Core.csproj b/src/_Authorization/Framework.Authorization.BLL.Core/Framework.Authorization.BLL.Core.csproj index c22324c95..117ab2dbd 100644 --- a/src/_Authorization/Framework.Authorization.BLL.Core/Framework.Authorization.BLL.Core.csproj +++ b/src/_Authorization/Framework.Authorization.BLL.Core/Framework.Authorization.BLL.Core.csproj @@ -4,7 +4,7 @@ - + diff --git a/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Framework.Authorization.BLL.Tests.Unit.csproj b/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Framework.Authorization.BLL.Tests.Unit.csproj index b36b8df2e..5a4f4c40b 100644 --- a/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Framework.Authorization.BLL.Tests.Unit.csproj +++ b/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Framework.Authorization.BLL.Tests.Unit.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Support/AuthorizationTestConfiguration.cs b/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Support/AuthorizationTestConfiguration.cs index eace56ec4..2a8ed684a 100644 --- a/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Support/AuthorizationTestConfiguration.cs +++ b/src/_Authorization/Framework.Authorization.BLL.Tests.Unit/Support/AuthorizationTestConfiguration.cs @@ -136,7 +136,7 @@ protected override void Initialize(T result) result.SecurityService.Returns(new AuthorizationSecurityService(result)); result.SourceListeners.Returns(new BLLSourceEventListenerContainer()); - result.OperationListeners.Returns(new BLLOperationEventListenerContainer()); + result.OperationSenders.Returns(new OperationEventSenderContainer(new List>())); var authContext = this.AuthorizationBLLContext; diff --git a/src/_Authorization/Framework.Authorization.Events/AuthorizationEventsSubscriptionManager.cs b/src/_Authorization/Framework.Authorization.Events/AuthorizationEventsSubscriptionManager.cs index 2330c3c99..3afbe317b 100644 --- a/src/_Authorization/Framework.Authorization.Events/AuthorizationEventsSubscriptionManager.cs +++ b/src/_Authorization/Framework.Authorization.Events/AuthorizationEventsSubscriptionManager.cs @@ -1,17 +1,15 @@ using System; -using Framework.Authorization.BLL; using Framework.Authorization.Domain; using Framework.Core; -using Framework.DomainDriven.BLL; using Framework.Events; namespace Framework.Authorization.Events { - public class AuthorizationEventsSubscriptionManager : EventsSubscriptionManagerBase + public class AuthorizationEventsSubscriptionManager : EventsSubscriptionManagerBase { - public AuthorizationEventsSubscriptionManager(IAuthorizationBLLContext context, IMessageSender> messageSender) - : base(context, messageSender) + public AuthorizationEventsSubscriptionManager(IMessageSender> messageSender) + : base(messageSender) { } diff --git a/src/_Authorization/Framework.Authorization.Events/AuthorizationLocalDBEventMessageSender.cs b/src/_Authorization/Framework.Authorization.Events/AuthorizationLocalDBEventMessageSender.cs index 06c71f196..3d8e0113f 100644 --- a/src/_Authorization/Framework.Authorization.Events/AuthorizationLocalDBEventMessageSender.cs +++ b/src/_Authorization/Framework.Authorization.Events/AuthorizationLocalDBEventMessageSender.cs @@ -13,7 +13,7 @@ public class AuthorizationLocalDBEventMessageSender : LocalDBEventMessageSender< { private readonly bool shrinkDto; - public AuthorizationLocalDBEventMessageSender([NotNull] IAuthorizationBLLContext context, [NotNull] IConfigurationBLLContext configurationContext, [NotNull] string queueTag = "default", bool shrinkDto = true) + public AuthorizationLocalDBEventMessageSender([NotNull] IAuthorizationBLLContext context, [NotNull] IConfigurationBLLContext configurationContext, [NotNull] string queueTag = "authDALQuery", bool shrinkDto = true) : base(context, configurationContext, queueTag) => this.shrinkDto = shrinkDto; diff --git a/src/_Authorization/Framework.Authorization.Events/DefaultAuthDALListener.cs b/src/_Authorization/Framework.Authorization.Events/DefaultAuthDALListener.cs index 08b9381de..2ce78b025 100644 --- a/src/_Authorization/Framework.Authorization.Events/DefaultAuthDALListener.cs +++ b/src/_Authorization/Framework.Authorization.Events/DefaultAuthDALListener.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Framework.Authorization.BLL; using Framework.Authorization.Domain; @@ -10,9 +11,23 @@ namespace Framework.Authorization.Events { public class DefaultAuthDALListener : DependencyDetailEventDALListener { - public DefaultAuthDALListener(IAuthorizationBLLContext context, IList typeEvents, IMessageSender> messageSender, IList dependencies) - : base(context, typeEvents, messageSender, dependencies) + public DefaultAuthDALListener(IAuthorizationBLLContext context, IMessageSender> messageSender) + : base(context, messageSender, DefaultEventTypes, DefaultDependencyEvents) { } + + public static readonly IReadOnlyCollection DefaultEventTypes = new[] + { + TypeEvent.Save(), + TypeEvent.SaveAndRemove(), + TypeEvent.SaveAndRemove() + }; + + + public static readonly IReadOnlyCollection DefaultDependencyEvents = new[] + { + TypeEventDependency.FromSaveAndRemove(z => z.Permission), + TypeEventDependency.FromSaveAndRemove(z => z.Principal) + }; } } diff --git a/src/_Authorization/Framework.Authorization.TestGenerate/Framework.Authorization.TestGenerate.csproj b/src/_Authorization/Framework.Authorization.TestGenerate/Framework.Authorization.TestGenerate.csproj index 9773320ec..13478cee0 100644 --- a/src/_Authorization/Framework.Authorization.TestGenerate/Framework.Authorization.TestGenerate.csproj +++ b/src/_Authorization/Framework.Authorization.TestGenerate/Framework.Authorization.TestGenerate.csproj @@ -3,9 +3,9 @@ Luxoft.Framework.Authorization.TestGenerate - - - + + + diff --git a/src/_Authorization/Framework.Authorization.WebApi/AuthSLJsonController.cs b/src/_Authorization/Framework.Authorization.WebApi/AuthSLJsonController.cs index c859f30b8..e80df6244 100644 --- a/src/_Authorization/Framework.Authorization.WebApi/AuthSLJsonController.cs +++ b/src/_Authorization/Framework.Authorization.WebApi/AuthSLJsonController.cs @@ -1,17 +1,11 @@ -using System; - -using Framework.Authorization.BLL; +using Framework.Authorization.BLL; using Framework.Authorization.Generated.DTO; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.IAD; using Framework.DomainDriven.ServiceModel.Service; using Framework.DomainDriven.WebApiNetCore; -using Framework.Exceptions; using Framework.WebApi.Utils.SL; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Server.HttpSys; namespace Framework.Authorization.WebApi { @@ -21,10 +15,9 @@ namespace Framework.Authorization.WebApi [Route("AuthSLJsonFacade.svc")] [ApiExplorerSettings(IgnoreApi = true)] //[Authorize(nameof(AuthenticationSchemes.NTLM))] - public abstract partial class AuthSLJsonController : ApiControllerBase, IAuthorizationBLLContext, EvaluatedData> + public abstract partial class AuthSLJsonController : ApiControllerBase> { - protected AuthSLJsonController(IServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + protected AuthSLJsonController() { } diff --git a/src/_Authorization/Framework.Authorization.WebApiGenerate/Framework.Authorization.WebApiGenerate.csproj b/src/_Authorization/Framework.Authorization.WebApiGenerate/Framework.Authorization.WebApiGenerate.csproj index b665507f1..6e015919a 100644 --- a/src/_Authorization/Framework.Authorization.WebApiGenerate/Framework.Authorization.WebApiGenerate.csproj +++ b/src/_Authorization/Framework.Authorization.WebApiGenerate/Framework.Authorization.WebApiGenerate.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Framework.Configuration.BLL.Core.Tests.Unit.csproj b/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Framework.Configuration.BLL.Core.Tests.Unit.csproj index ca122ee1d..052417a29 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Framework.Configuration.BLL.Core.Tests.Unit.csproj +++ b/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Framework.Configuration.BLL.Core.Tests.Unit.csproj @@ -6,13 +6,13 @@ - + - - - + + + diff --git a/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Notification/ExceptionMessageSenderTests.cs b/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Notification/ExceptionMessageSenderTests.cs index 774b59f32..b11b6d6c4 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Notification/ExceptionMessageSenderTests.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/Notification/ExceptionMessageSenderTests.cs @@ -98,12 +98,10 @@ public void Send_SomeException_CorrectMessageWasSent() Message sendedMessage = null; - this.messageSender.Send(Arg.Do(m => sendedMessage = m), TransactionMessageMode.Auto); + this.messageSender.Send(Arg.Do(m => sendedMessage = m)); // Act - sender.Send( - exception, - this.Fixture.Create()); + sender.Send(exception); // Assert sendedMessage.Sender.Should().Be(FromAddress); @@ -121,11 +119,10 @@ public void Send_InheritorSpecifiesExcludeExceptionType_MessageWasNotSent() // Act sender.Send( - this.Fixture.Create(), - this.Fixture.Create()); + this.Fixture.Create()); // Assert - this.messageSender.DidNotReceive().Send(Arg.Any(), TransactionMessageMode.Auto); + this.messageSender.DidNotReceive().Send(Arg.Any()); } [Test] @@ -156,10 +153,10 @@ private void TestMessageWasNotSent(Exception exception) var sender = this.Fixture.Create(); // Act - sender.Send(exception, this.Fixture.Create()); + sender.Send(exception); // Assert - this.messageSender.DidNotReceive().Send(Arg.Any(), TransactionMessageMode.Auto); + this.messageSender.DidNotReceive().Send(Arg.Any()); } private void TestMessageWasSent(string login) @@ -173,11 +170,10 @@ private void TestMessageWasSent(string login) // Act sender.Send( - this.Fixture.Create(), - this.Fixture.Create()); + this.Fixture.Create()); // Assert - this.messageSender.DidNotReceive().Send(Arg.Any(), TransactionMessageMode.Auto); + this.messageSender.DidNotReceive().Send(Arg.Any()); } public class TestingExceptionMessageSender : ExceptionMessageSender diff --git a/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/SubscriptionSystemService3/Services/NotificationServiceTests.cs b/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/SubscriptionSystemService3/Services/NotificationServiceTests.cs index 745a44452..2c820e074 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/SubscriptionSystemService3/Services/NotificationServiceTests.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core.Tests.Unit/SubscriptionSystemService3/Services/NotificationServiceTests.cs @@ -60,7 +60,7 @@ public void NotifyDomainObjectChanged_NoErrors_EmptyTryResultCollection() var template = new MessageTemplateNotification("test", this, this.GetType(), new string[0], new string[0], new string[0], null); - this.templateSender.Send(template, TransactionMessageMode.Auto); + this.templateSender.Send(template); this.subscriptionsResolver.Resolve(versions).Returns(subscriptions); @@ -84,7 +84,7 @@ public void NotifyDomainObjectChanged_SubscriptionAndVersions_InnerComponentsCor var subscriptions = this.Fixture.CreateMany(1).ToList(); var subscription = subscriptions.Single(); - + var template = new MessageTemplateNotification("test", this, this.GetType(), new string[0], new string[0], new string[0], null, subscription); this.templateFactory.Create(Arg.Is>(v => v.SequenceEqual(subscriptions)), versions).Returns(new List { template }); @@ -97,7 +97,7 @@ public void NotifyDomainObjectChanged_SubscriptionAndVersions_InnerComponentsCor this.templateFactory.Received().Create(Arg.Is>(v => v.SequenceEqual(subscriptions)), versions); - this.templateSender.Received().Send(template, TransactionMessageMode.Auto); + this.templateSender.Received().Send(template); } [Test] diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/AuthorizationValidatorCompileCache.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/AuthorizationValidatorCompileCache.cs new file mode 100644 index 000000000..37e4177b8 --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/AuthorizationValidatorCompileCache.cs @@ -0,0 +1,18 @@ +using System; + +using Framework.Core; +using Framework.Validation; + +using Framework.DomainDriven.BLL; + +namespace Framework.Configuration.BLL; + +public class ConfigurationValidatorCompileCache : ValidatorCompileCache +{ + public ConfigurationValidatorCompileCache(IAvailableValues availableValues) : + base(availableValues + .ToBLLContextValidationExtendedData() + .Pipe(extendedValidationData => new ConfigurationValidationMap(extendedValidationData))) + { + } +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContext.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContext.cs index 990f0a26e..58513362c 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContext.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContext.cs @@ -15,28 +15,18 @@ using Framework.Exceptions; using Framework.HierarchicalExpand; using Framework.Notification; -using Framework.Notification.DTO; using Framework.Persistent; using Framework.QueryLanguage; -using Framework.Report; using Framework.SecuritySystem; -using Framework.Validation; using JetBrains.Annotations; namespace Framework.Configuration.BLL { + public partial class ConfigurationBLLContext { - internal const string SubscriptionLoggerName = "Subscription"; - - private static readonly ITypeResolver CurrentTargetSystemTypeResolver = TypeSource.FromSample().ToDefaultTypeResolver(); - - private readonly Lazy lazySecurityService; - - private readonly Lazy lazyLogics; - - private readonly Func> getEmployeeSourceFunc; + private readonly IBLLSimpleQueryBase employeeSource; private readonly Lazy> lazyTargetSystemServiceCache; @@ -44,46 +34,40 @@ public partial class ConfigurationBLLContext private readonly IDictionaryCache domainTypeNameCache; - private readonly Func getCurrentRevision; + private readonly ICurrentRevisionService currentRevisionService; public ConfigurationBLLContext( IServiceProvider serviceProvider, [NotNull] IDALFactory dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IAccessDeniedExceptionService accessDeniedExceptionService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, - [NotNull] IValidator validator, + [NotNull] IConfigurationValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, [NotNull] IFetchService fetchService, - [NotNull] IDateTimeService dateTimeService, [NotNull] ISecurityExpressionBuilderFactory securityExpressionBuilderFactory, - IMessageSender exceptionSender, - IMessageSender subscriptionSender, - Func getSecurityService, - Func getLogics, - IAuthorizationBLLContext authorizationBLLContext, - Func> getEmployeeSourceFunc, - IEnumerable targetSystemServices, - [NotNull] ISerializerFactory systemConstantSerializerFactory, + [NotNull] IMessageSender subscriptionSender, + [NotNull] IConfigurationSecurityService securityService, + [NotNull] IConfigurationBLLFactoryContainer logics, + [NotNull] IAuthorizationBLLContext authorization, + [NotNull] IBLLSimpleQueryBase employeeSource, + [NotNull] IEnumerable targetSystemServices, + [NotNull] IConfigurationBLLContextSettings settings, [NotNull] IExceptionService exceptionService, - [NotNull] Func getCurrentRevision) - : base(serviceProvider, dalFactory, operationListeners, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService, dateTimeService) + [NotNull] ICurrentRevisionService currentRevisionService) + : base(serviceProvider, dalFactory, operationSenders, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService) { - if (getSecurityService == null) throw new ArgumentNullException(nameof(getSecurityService)); - if (getLogics == null) throw new ArgumentNullException(nameof(getLogics)); - this.SecurityExpressionBuilderFactory = securityExpressionBuilderFactory ?? throw new ArgumentNullException(nameof(securityExpressionBuilderFactory)); - this.ExceptionSender = exceptionSender ?? throw new ArgumentNullException(nameof(exceptionSender)); this.SubscriptionSender = subscriptionSender ?? throw new ArgumentNullException(nameof(subscriptionSender)); - this.lazySecurityService = getSecurityService.ToLazy(); - this.lazyLogics = getLogics.ToLazy(); + this.SecurityService = securityService; + this.Logics = logics; - this.Authorization = authorizationBLLContext ?? throw new ArgumentNullException(nameof(authorizationBLLContext)); - this.getEmployeeSourceFunc = getEmployeeSourceFunc ?? throw new ArgumentNullException(nameof(getEmployeeSourceFunc)); - this.getCurrentRevision = getCurrentRevision ?? throw new ArgumentNullException(nameof(getCurrentRevision)); + this.Authorization = authorization ?? throw new ArgumentNullException(nameof(authorization)); + this.employeeSource = employeeSource ?? throw new ArgumentNullException(nameof(employeeSource)); + this.currentRevisionService = currentRevisionService ?? throw new ArgumentNullException(nameof(currentRevisionService)); this.ExceptionService = exceptionService ?? throw new ArgumentNullException(nameof(exceptionService)); @@ -97,7 +81,7 @@ public ConfigurationBLLContext( domainType => this.Logics.DomainType.GetByDomainType(domainType), new EqualityComparerImpl((dt1, dt2) => dt1.Name == dt2.Name && dt1.NameSpace == dt2.NameSpace, dt => dt.Name.GetHashCode() ^ dt.NameSpace.GetHashCode())).WithLock(); - this.SystemConstantSerializerFactory = systemConstantSerializerFactory ?? throw new ArgumentNullException(nameof(systemConstantSerializerFactory)); + this.SystemConstantSerializerFactory = settings.SystemConstantSerializerFactory; this.ComplexDomainTypeResolver = TypeResolverHelper.Create( (DomainType domainType) => @@ -110,22 +94,21 @@ public ConfigurationBLLContext( { return this.GetTargetSystemService(domainType.TargetSystem).TypeResolver.Resolve(domainType); } - }, () => this.GetTargetSystemServices().SelectMany(tss => tss.TypeResolver.GetTypes()).Concat(TypeResolverHelper.Base.GetTypes())).WithCache().WithLock(); + + this.TypeResolver = settings.TypeResolver; } public IMessageSender SubscriptionSender { get; } - public IConfigurationSecurityService SecurityService => this.lazySecurityService.Value; - - public IMessageSender ExceptionSender { get; } + public IConfigurationSecurityService SecurityService { get; } - public ITypeResolver TypeResolver => CurrentTargetSystemTypeResolver; + public ITypeResolver TypeResolver { get; } public ITypeResolver ComplexDomainTypeResolver { get; } - public override IConfigurationBLLFactoryContainer Logics => this.lazyLogics.Value; + public override IConfigurationBLLFactoryContainer Logics { get; } public IAuthorizationBLLContext Authorization { get; } @@ -144,12 +127,12 @@ public ConfigurationBLLContext( /// public long GetCurrentRevision() { - return this.getCurrentRevision(); + return this.currentRevisionService.GetCurrentRevision(); } public IBLLSimpleQueryBase GetEmployeeSource() { - return this.getEmployeeSourceFunc(BLLSecurityMode.Disabled); + return this.employeeSource; } public IPersistentTargetSystemService GetPersistentTargetSystemService(TargetSystem targetSystem) diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContextSettings.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContextSettings.cs new file mode 100644 index 000000000..ecd6fb7e2 --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationBLLContextSettings.cs @@ -0,0 +1,15 @@ +using System; + +using Framework.Core; + +using Framework.Configuration.Domain; +using Framework.Core.Serialization; + +namespace Framework.Configuration.BLL; + +public class ConfigurationBLLContextSettings : IConfigurationBLLContextSettings +{ + public ITypeResolver TypeResolver { get; init; } = TypeSource.FromSample().ToDefaultTypeResolver(); + + public ISerializerFactory SystemConstantSerializerFactory { get; init; } = SerializerFactory.Default; +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationValidator.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationValidator.cs new file mode 100644 index 000000000..fb0ed88ec --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/ConfigurationValidator.cs @@ -0,0 +1,5 @@ +namespace Framework.Configuration.BLL; + +public partial class ConfigurationValidator : IConfigurationValidator +{ +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContext.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContext.cs index 83546eaf2..ee914b6f0 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContext.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContext.cs @@ -25,9 +25,7 @@ public partial interface IConfigurationBLLContext : ITrackingServiceContainer, - IConfigurationBLLContextContainer, - - IDateTimeServiceContainer + IConfigurationBLLContextContainer { IMessageSender SubscriptionSender { get; } diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContextSettings.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContextSettings.cs new file mode 100644 index 000000000..3bdad48fc --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationBLLContextSettings.cs @@ -0,0 +1,9 @@ +using Framework.Core; +using Framework.Core.Serialization; + +namespace Framework.Configuration.BLL; + +public interface IConfigurationBLLContextSettings : ITypeResolverContainer +{ + ISerializerFactory SystemConstantSerializerFactory { get; } +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationValidator.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationValidator.cs new file mode 100644 index 000000000..70bf0245c --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Context/IConfigurationValidator.cs @@ -0,0 +1,7 @@ +using Framework.Validation; + +namespace Framework.Configuration.BLL; + +public interface IConfigurationValidator : IValidator +{ +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Context/Validation/ConfigurationValidationMapBase.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Context/Validation/ConfigurationValidationMapBase.cs deleted file mode 100644 index 3f92096cb..000000000 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Context/Validation/ConfigurationValidationMapBase.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Linq.Expressions; - -using Framework.Configuration.Domain; -using Framework.Core; -using Framework.Validation; - -namespace Framework.Configuration.BLL -{ - public partial class ConfigurationValidationMapBase - { - private IClassValidator GetReferencedSubscriptionLambdaValidator(Expression> propExpr) - where TDomainObject : PersistentDomainObjectBase - { - return new SubscriptionLambdaValidator(propExpr); - } - - private class SubscriptionLambdaValidator : IClassValidator - where TDomainObject : PersistentDomainObjectBase - { - private readonly Func>> getFilter; - - public SubscriptionLambdaValidator(Expression> propExpr) - { - if (propExpr == null) throw new ArgumentNullException(nameof(propExpr)); - - this.getFilter = lambda => from domainObjectLambda in propExpr - - select domainObjectLambda == lambda; - } - - public ValidationResult GetValidationResult(IClassValidationContext validationContext) - { - if (validationContext == null) throw new ArgumentNullException(nameof(validationContext)); - - var context = validationContext.ExtendedValidationData.GetValue(true); - - var objects = context.Logics.Default.Create().GetObjectsBy(this.getFilter(validationContext.Source)); - - return objects.Sum(obj => validationContext.Validator.GetValidationResult(obj, validationContext.OperationContext)); - } - } - } -} \ No newline at end of file diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Framework.Configuration.BLL.Core.csproj b/src/_Configuration/Framework.Configuration.BLL.Core/Framework.Configuration.BLL.Core.csproj index bf3f10fb0..ecb7b72c0 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Framework.Configuration.BLL.Core.csproj +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Framework.Configuration.BLL.Core.csproj @@ -3,7 +3,7 @@ Luxoft.Framework.Configuration.BLL.Core - + diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/DefaultMailSenderContainer.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/DefaultMailSenderContainer.cs new file mode 100644 index 000000000..fdc8faece --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/DefaultMailSenderContainer.cs @@ -0,0 +1,22 @@ +using System; +using System.Net.Mail; + +namespace Framework.Configuration.BLL.Notification; + +public class DefaultMailSenderContainer : IDefaultMailSenderContainer +{ + public DefaultMailSenderContainer(string defaultSender) + : this(new MailAddress(defaultSender, defaultSender)) + { + } + + public DefaultMailSenderContainer(MailAddress defaultSender) + { + if (defaultSender == null) throw new ArgumentNullException(nameof(defaultSender)); + if (string.IsNullOrWhiteSpace(defaultSender.DisplayName)) throw new System.ArgumentException("Not initialize sender name in NotificationContext", nameof(defaultSender)); + + this.DefaultSender = defaultSender; + } + + public MailAddress DefaultSender { get; } +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/ExceptionMessageSender.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/ExceptionMessageSender.cs index 1063182fc..d45dfe2d8 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/ExceptionMessageSender.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/ExceptionMessageSender.cs @@ -52,23 +52,13 @@ public ExceptionMessageSender( [NotNull] IEnumerable toAddresses) : base(context) { - if (messageSender == null) - { - throw new ArgumentNullException(nameof(messageSender)); - } - - if (fromAddress == null) - { - throw new ArgumentNullException(nameof(fromAddress)); - } - if (toAddresses == null) { throw new ArgumentNullException(nameof(toAddresses)); } - this.fromAddress = fromAddress; - this.messageSender = messageSender; + this.fromAddress = fromAddress ?? throw new ArgumentNullException(nameof(fromAddress)); + this.messageSender = messageSender ?? throw new ArgumentNullException(nameof(messageSender)); this.receivers = toAddresses.ToArray(); if (!this.receivers.Any()) @@ -81,9 +71,8 @@ public ExceptionMessageSender( /// Осуществляет отправку уведомления об исключении. /// /// Исключение. - /// Тип транзакции, используемый при отправке. /// Аргумент равен null. - public void Send(Exception exception, TransactionMessageMode sendMessageMode) + public void Send(Exception exception) { if (exception == null) { @@ -111,7 +100,7 @@ public void Send(Exception exception, TransactionMessageMode sendMessageMode) false, new Attachment[0]); - this.messageSender.Send(message, sendMessageMode); + this.messageSender.Send(message); } /// diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/IDefaultMailSenderContainer.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/IDefaultMailSenderContainer.cs new file mode 100644 index 000000000..d4569b0df --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/IDefaultMailSenderContainer.cs @@ -0,0 +1,8 @@ +using System.Net.Mail; + +namespace Framework.Configuration.BLL.Notification; + +public interface IDefaultMailSenderContainer +{ + MailAddress DefaultSender { get; } +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/NotificationMessageSender.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/NotificationMessageSender.cs index e17407ee0..215d038bf 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/NotificationMessageSender.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/NotificationMessageSender.cs @@ -1,50 +1,30 @@ using System; -using System.Net.Mail; + using Framework.Core; using Framework.DomainDriven.BLL; using Framework.Notification.DTO; namespace Framework.Configuration.BLL.Notification { - public static partial class MessageSenderExtensions + public class NotificationMessageSender : BLLContextContainer, IMessageSender { - /// - /// Creates and returns notification message sender - /// - /// Base notification event sender - /// Configuration context - /// Default message sender - /// Notification message sender - public static IMessageSender ToNotificationSender(this IMessageSender notificationEventSender, IConfigurationBLLContext context, MailAddress defaultSender) - { - if (notificationEventSender == null) throw new ArgumentNullException(nameof(notificationEventSender)); - if (context == null) throw new ArgumentNullException(nameof(context)); - if (defaultSender == null) throw new ArgumentNullException(nameof(defaultSender)); - - return new NotificationMessageSender(context, notificationEventSender, defaultSender); - } + private readonly IDefaultMailSenderContainer defaultMailSenderContainer; - private class NotificationMessageSender : BLLContextContainer, IMessageSender - { - private readonly MailAddress _defaultSender; - private readonly IMessageSender _notificationEventSender; + private readonly IMessageSender notificationEventSender; - public NotificationMessageSender(IConfigurationBLLContext context, IMessageSender notificationEventSender, MailAddress defaultSender) + public NotificationMessageSender(IConfigurationBLLContext context, IMessageSender notificationEventSender, IDefaultMailSenderContainer defaultMailSenderContainer) : base(context) - { - if (defaultSender == null) throw new ArgumentNullException(nameof(defaultSender)); - if (notificationEventSender == null) throw new ArgumentNullException(nameof(notificationEventSender)); + { + this.defaultMailSenderContainer = defaultMailSenderContainer ?? throw new ArgumentNullException(nameof(defaultMailSenderContainer)); + this.notificationEventSender = notificationEventSender ?? throw new ArgumentNullException(nameof(notificationEventSender)); + } - this._defaultSender = defaultSender; - this._notificationEventSender = notificationEventSender; - } + public void Send(Framework.Notification.Notification notification) + { + notification.Message.Sender = notification.Message.Sender ?? this.defaultMailSenderContainer.DefaultSender; - public void Send(Framework.Notification.Notification notification, TransactionMessageMode transactionMessageMode) - { - notification.Message.Sender = notification.Message.Sender ?? this._defaultSender; - this._notificationEventSender.Send(new NotificationEventDTO(notification), transactionMessageMode); - } + this.notificationEventSender.Send(new NotificationEventDTO(notification)); } } -} \ No newline at end of file +} diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/TemplateMessageSender.cs b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/TemplateMessageSender.cs index 1b2a93729..d00581a0e 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/Notification/TemplateMessageSender.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/Notification/TemplateMessageSender.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Net.Mail; using Framework.Configuration.Core; @@ -16,146 +14,88 @@ namespace Framework.Configuration.BLL.Notification { - public static partial class MessageSenderExtensions + public class TemplateMessageSender : BLLContextContainer, IMessageSender { - public static IMessageSender ToMessageTemplateSender(this IMessageSender notificationEventSender, IConfigurationBLLContext context, MailAddress defaultSender) - { - if (notificationEventSender == null) - { - throw new ArgumentNullException(nameof(notificationEventSender)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (defaultSender == null) - { - throw new ArgumentNullException(nameof(defaultSender)); - } - - return new TemplateMessageSender(context, notificationEventSender, defaultSender); - } + private readonly IDefaultMailSenderContainer defaultMailSenderContainer; + private readonly IMessageSender notificationEventSender; - public static IMessageSender ToExceptionSender(this IMessageSender messageSender, IConfigurationBLLContext context, MailAddress sender, IEnumerable receivers) + public TemplateMessageSender(IConfigurationBLLContext context, IMessageSender notificationEventSender, IDefaultMailSenderContainer defaultMailSenderContainer) + : base(context) { - if (messageSender == null) - { - throw new ArgumentNullException(nameof(messageSender)); - } - - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (sender == null) - { - throw new ArgumentNullException(nameof(sender)); - } - - if (receivers == null) - { - throw new ArgumentNullException(nameof(receivers)); - } - - return new ExceptionMessageSender(context, messageSender, sender, receivers); + this.defaultMailSenderContainer = defaultMailSenderContainer ?? throw new ArgumentNullException(nameof(defaultMailSenderContainer)); + this.notificationEventSender = notificationEventSender ?? throw new ArgumentNullException(nameof(notificationEventSender)); + this.Logger = Log.Logger.ForContext(this.GetType()); } - private class TemplateMessageSender : BLLContextContainer, IMessageSender - { - private readonly MailAddress _defaultSender; - private readonly IMessageSender _notificationEventSender; + private ILogger Logger { get; } - public TemplateMessageSender(IConfigurationBLLContext context, IMessageSender notificationEventSender, MailAddress defaultSender) - : base(context) + public void Send(MessageTemplateNotification message) + { + if (message == null) { - if (defaultSender == null) - { - throw new ArgumentNullException(nameof(defaultSender)); - } - - if (notificationEventSender == null) - { - throw new ArgumentNullException(nameof(notificationEventSender)); - } - - this._defaultSender = defaultSender; - this._notificationEventSender = notificationEventSender; - this.Logger = Log.Logger.ForContext(this.GetType()); + throw new ArgumentNullException(nameof(message)); } - private ILogger Logger { get; } - - public void Send(MessageTemplateNotification message, TransactionMessageMode transactionMessageMode) + if (!message.SendWithEmptyListOfRecipients) { - if (message == null) - { - throw new ArgumentNullException(nameof(message)); - } + var receiversCollection = message.Receivers.ToList(); - if (!message.SendWithEmptyListOfRecipients) + if (!receiversCollection.Any()) { - var receiversCollection = message.Receivers.ToList(); - - if (!receiversCollection.Any()) - { - return; - } + return; } + } - var notification = this.CreateNotification(message); + var notification = this.CreateNotification(message); - notification.Message.IsBodyHtml = true; + notification.Message.IsBodyHtml = true; - this.Logger.Information( - "Send message template: '{MessageTemplateCode}'; Receivers: '{To}'; From: '{From}'; Send message body:{Body}", - message.MessageTemplateCode, - notification.Message.To, - notification.Message.From, - notification.Message.Body); + this.Logger.Information( + "Send message template: '{MessageTemplateCode}'; Receivers: '{To}'; From: '{From}'; Send message body:{Body}", + message.MessageTemplateCode, + notification.Message.To, + notification.Message.From, + notification.Message.Body); - this._notificationEventSender.Send(new NotificationEventDTO(notification), transactionMessageMode); - } + this.notificationEventSender.Send(new NotificationEventDTO(notification)); + } - private Framework.Notification.Notification CreateNotification(MessageTemplateNotification message) + private Framework.Notification.Notification CreateNotification(MessageTemplateNotification message) + { + if (message == null) { - if (message == null) - { - throw new ArgumentNullException(nameof(message)); - } + throw new ArgumentNullException(nameof(message)); + } - var messageTemplate = new MessageTemplate(); + var messageTemplate = new MessageTemplate(); - var splittedReceivers = message.Receivers.SelectMany(z => z.Split(new[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(); - var splittedCarbonCopy = message.CopyReceivers.SelectMany(z => z.Split(new[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(); - var splittedReplyTo = message.ReplyTo.SelectMany(z => z.Split(new[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(); + var splittedReceivers = message.Receivers.SelectMany(z => z.Split(new[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(); + var splittedCarbonCopy = message.CopyReceivers.SelectMany(z => z.Split(new[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(); + var splittedReplyTo = message.ReplyTo.SelectMany(z => z.Split(new[] { ';', ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(); - var includeAttachments = message.Subscription.Maybe(s => s.IncludeAttachments, true); + var includeAttachments = message.Subscription.Maybe(s => s.IncludeAttachments, true); - var sender = message.Subscription.Maybe(s => s.Sender) ?? this._defaultSender; + var sender = message.Subscription.Maybe(s => s.Sender) ?? this.defaultMailSenderContainer.DefaultSender; - var messageTemplateBLL = new MessageTemplateBLL(this.Context); + var messageTemplateBLL = new MessageTemplateBLL(this.Context); - var mailMessage = messageTemplateBLL.CreateMailMessage( - message, - messageTemplate, - includeAttachments, - message.ContextObject, - sender, - splittedReceivers, - splittedCarbonCopy, - splittedReplyTo, - message.Attachments); + var mailMessage = messageTemplateBLL.CreateMailMessage( + message, + messageTemplate, + includeAttachments, + message.ContextObject, + sender, + splittedReceivers, + splittedCarbonCopy, + splittedReplyTo, + message.Attachments); - var technicalInformation = new NotificationTechnicalInformation( - message.MessageTemplateCode, - message.ContextObjectType.Name, - (message.ContextObject as IIdentityObject ?? (message.ContextObject as IDomainObjectVersions).Maybe(ver => ver.Current ?? ver.Previous) as IIdentityObject).MaybeToNullable(obj => obj.Id)); + var technicalInformation = new NotificationTechnicalInformation( + message.MessageTemplateCode, + message.ContextObjectType.Name, + (message.ContextObject as IIdentityObject ?? (message.ContextObject as IDomainObjectVersions).Maybe(ver => ver.Current ?? ver.Previous) as IIdentityObject).MaybeToNullable(obj => obj.Id)); - return new Framework.Notification.Notification(technicalInformation, mailMessage); - } + return new Framework.Notification.Notification(technicalInformation, mailMessage); } } } diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/LocalDBNotificationEventDTOMessageSender.cs b/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/LocalDBNotificationEventDTOMessageSender.cs index 46cb9262e..85badbfc7 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/LocalDBNotificationEventDTOMessageSender.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/LocalDBNotificationEventDTOMessageSender.cs @@ -24,7 +24,7 @@ public LocalDBNotificationEventDTOMessageSender([NotNull] IConfigurationBLLConte } /// - public void Send([NotNull] NotificationEventDTO dto, TransactionMessageMode sendMessageMode = TransactionMessageMode.Auto) + public void Send([NotNull] NotificationEventDTO dto) { if (dto == null) { diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/SubscriptionSystemService3/Services/SubscriptionNotificationService.cs b/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/SubscriptionSystemService3/Services/SubscriptionNotificationService.cs index 438f4d300..a87fe1d7a 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/SubscriptionSystemService3/Services/SubscriptionNotificationService.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/SubscriptionSystemService/SubscriptionSystemService3/Services/SubscriptionNotificationService.cs @@ -239,7 +239,7 @@ private void SendTemplates(IEnumerable templates) private MessageTemplateNotification SendTemplate(MessageTemplateNotification template) { - this.templateSender.Send(template, TransactionMessageMode.Auto); + this.templateSender.Send(template); return template; } diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemService.cs b/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemService.cs index fe3c29c3d..fd33f5d07 100644 --- a/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemService.cs +++ b/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemService.cs @@ -9,10 +9,8 @@ using Framework.DomainDriven.BLL; using Framework.DomainDriven.BLL.Security; using Framework.Events; -using Framework.Exceptions; using Framework.Notification; using Framework.Persistent; -using Framework.SecuritySystem; using JetBrains.Annotations; @@ -89,13 +87,13 @@ private void ForceEvent(string operationName, long? r var operation = EnumHelper.Parse(operationName); - var listener = this.TargetSystemContext.OperationListeners.GetEventListener(); + var listener = this.TargetSystemContext.OperationSenders.GetEventSender(); - listener.ForceEvent(domainObject, operation); + listener.SendEvent(domainObject, operation); operation.ToOperationMaybe().Match( eventOperation => - this.eventDalListeners.Foreach(dalListener => dalListener.GetForceEventContainer().ForceEvent(domainObject, eventOperation))); + this.eventDalListeners.Foreach(dalListener => dalListener.GetForceEventContainer().SendEvent(domainObject, eventOperation))); } public override bool IsAssignable(Type domainType) diff --git a/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemServiceFactory.cs b/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemServiceFactory.cs new file mode 100644 index 000000000..a783c9d80 --- /dev/null +++ b/src/_Configuration/Framework.Configuration.BLL.Core/TargetSystemService/TargetSystemServiceFactory.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Framework.Configuration.Domain; +using Framework.Core; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.BLL.Security; +using Framework.Persistent; + +using Microsoft.Extensions.DependencyInjection; + +namespace Framework.Configuration.BLL; + +public class TargetSystemServiceFactory +{ + private readonly IServiceProvider serviceProvider; + + private readonly Lazy> lazyTargetSystems; + + public TargetSystemServiceFactory(IServiceProvider serviceProvider, IConfigurationBLLContext context) + { + this.serviceProvider = serviceProvider; + + this.lazyTargetSystems = LazyHelper.Create(() => context.Logics.TargetSystem.GetFullList()); + } + + public ITargetSystemService Create(string name) + where TBLLContext : class, ITypeResolverContainer, ISecurityServiceContainer>, IDefaultBLLContext, IBLLOperationEventContext + where TPersistentDomainObjectBase : class, IIdentityObject + { + return this.Create(tss => tss.Name == name); + } + + public ITargetSystemService Create(Func filter) + where TBLLContext : class, ITypeResolverContainer, ISecurityServiceContainer>, IDefaultBLLContext, IBLLOperationEventContext + where TPersistentDomainObjectBase : class, IIdentityObject + { + return LazyInterfaceImplementHelper.CreateProxy(() => + { + var targetSystem = this.lazyTargetSystems.Value.Single(filter); + + return ActivatorUtilities.CreateInstance>(this.serviceProvider, targetSystem); + }); + } +} diff --git a/src/_Configuration/Framework.Configuration.Core.Tests.Unit/Framework.Configuration.Core.Tests.Unit.csproj b/src/_Configuration/Framework.Configuration.Core.Tests.Unit/Framework.Configuration.Core.Tests.Unit.csproj index 95459842f..9dc950505 100644 --- a/src/_Configuration/Framework.Configuration.Core.Tests.Unit/Framework.Configuration.Core.Tests.Unit.csproj +++ b/src/_Configuration/Framework.Configuration.Core.Tests.Unit/Framework.Configuration.Core.Tests.Unit.csproj @@ -4,13 +4,13 @@ - + - - - + + + diff --git a/src/_Configuration/Framework.Configuration.SubscriptionModeling.Tests.Unit/Framework.Configuration.SubscriptionModeling.Tests.Unit.csproj b/src/_Configuration/Framework.Configuration.SubscriptionModeling.Tests.Unit/Framework.Configuration.SubscriptionModeling.Tests.Unit.csproj index f423d33bf..54f70b784 100644 --- a/src/_Configuration/Framework.Configuration.SubscriptionModeling.Tests.Unit/Framework.Configuration.SubscriptionModeling.Tests.Unit.csproj +++ b/src/_Configuration/Framework.Configuration.SubscriptionModeling.Tests.Unit/Framework.Configuration.SubscriptionModeling.Tests.Unit.csproj @@ -3,9 +3,9 @@ false - - - + + + diff --git a/src/_Configuration/Framework.Configuration.TestGenerate/Framework.Configuration.TestGenerate.csproj b/src/_Configuration/Framework.Configuration.TestGenerate/Framework.Configuration.TestGenerate.csproj index 491367694..50bdf9b23 100644 --- a/src/_Configuration/Framework.Configuration.TestGenerate/Framework.Configuration.TestGenerate.csproj +++ b/src/_Configuration/Framework.Configuration.TestGenerate/Framework.Configuration.TestGenerate.csproj @@ -3,9 +3,9 @@ Luxoft.Framework.Configuration.TestGenerate - - - + + + diff --git a/src/_Configuration/Framework.Configuration.WebApi/ConfigSLJsonController.cs b/src/_Configuration/Framework.Configuration.WebApi/ConfigSLJsonController.cs index f0d4dbd10..cffac1b74 100644 --- a/src/_Configuration/Framework.Configuration.WebApi/ConfigSLJsonController.cs +++ b/src/_Configuration/Framework.Configuration.WebApi/ConfigSLJsonController.cs @@ -1,17 +1,11 @@ -using System; - -using Framework.Configuration.BLL; +using Framework.Configuration.BLL; using Framework.Configuration.Generated.DTO; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.IAD; using Framework.DomainDriven.ServiceModel.Service; using Framework.DomainDriven.WebApiNetCore; -using Framework.Exceptions; using Framework.WebApi.Utils.SL; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Server.HttpSys; namespace Framework.Configuration.WebApi { @@ -20,11 +14,9 @@ namespace Framework.Configuration.WebApi [ApiController] [Route("ConfigSLJsonFacade.svc")] [ApiExplorerSettings(IgnoreApi = true)] - //[Authorize(nameof(AuthenticationSchemes.NTLM))] - public abstract partial class ConfigSLJsonController : ApiControllerBase, IConfigurationBLLContext, EvaluatedData> + public abstract partial class ConfigSLJsonController : ApiControllerBase> { - protected ConfigSLJsonController(IServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + protected ConfigSLJsonController() { } diff --git a/src/_Configuration/Framework.Configuration.WebApi/Impl/ExceptionMessageService.cs b/src/_Configuration/Framework.Configuration.WebApi/Impl/ExceptionMessageService.cs index d95c21b1c..8c18fa9aa 100644 --- a/src/_Configuration/Framework.Configuration.WebApi/Impl/ExceptionMessageService.cs +++ b/src/_Configuration/Framework.Configuration.WebApi/Impl/ExceptionMessageService.cs @@ -43,7 +43,7 @@ private static void SendMessage(EvaluatedData evaluate { try { - evaluateData.Context.ExceptionSender.Send(mappedMessage.ToException(), TransactionMessageMode.Auto); + evaluateData.Context.ExceptionService.Save(mappedMessage.ToException()); } catch (Exception e) { diff --git a/src/_Configuration/Framework.Configuration.WebApiGenerate/Framework.Configuration.WebApiGenerate.csproj b/src/_Configuration/Framework.Configuration.WebApiGenerate/Framework.Configuration.WebApiGenerate.csproj index 5ebfdfd43..48cc82a9b 100644 --- a/src/_Configuration/Framework.Configuration.WebApiGenerate/Framework.Configuration.WebApiGenerate.csproj +++ b/src/_Configuration/Framework.Configuration.WebApiGenerate/Framework.Configuration.WebApiGenerate.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Configuration/IConfigurationBLLContext.cs b/src/_DomainDriven/Framework.DomainDriven.BLL.Configuration/IConfigurationBLLContext.cs index 1937fc7ea..6dd37163e 100644 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Configuration/IConfigurationBLLContext.cs +++ b/src/_DomainDriven/Framework.DomainDriven.BLL.Configuration/IConfigurationBLLContext.cs @@ -5,7 +5,7 @@ namespace Framework.DomainDriven.BLL.Configuration { - public interface IConfigurationBLLContext : IExceptionSenderContainer + public interface IConfigurationBLLContext { bool DisplayInternalError { get; } diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/Framework.DomainDriven.BLL.Security.Tests.Unit.csproj b/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/Framework.DomainDriven.BLL.Security.Tests.Unit.csproj index 9cf1884fc..7d426c06f 100644 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/Framework.DomainDriven.BLL.Security.Tests.Unit.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/Framework.DomainDriven.BLL.Security.Tests.Unit.csproj @@ -4,8 +4,8 @@ - - + + diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/SecurityHierarchy/Domain/TestBLLContext.cs b/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/SecurityHierarchy/Domain/TestBLLContext.cs index 806958740..a02c78ffa 100644 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/SecurityHierarchy/Domain/TestBLLContext.cs +++ b/src/_DomainDriven/Framework.DomainDriven.BLL.Security.Tests.Unit/SecurityHierarchy/Domain/TestBLLContext.cs @@ -69,7 +69,7 @@ public TestBLLContext(List hierarchicalObjects) public HierarchyDomainAncestorLogic HierarchyDomainAncestorLogic => this._hierarchyDomainAncestorLogic; - public IBLLOperationEventListenerContainer OperationListeners => new BLLOperationEventListenerContainer(); + public IOperationEventSenderContainer OperationSenders => new OperationEventSenderContainer(new List>()); public BLLSourceEventListenerContainer SourceListeners => new BLLSourceEventListenerContainer(); diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Context/IImpersonateObject.cs b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Context/IImpersonateObject.cs deleted file mode 100644 index 41791225d..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Context/IImpersonateObject.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Framework.DomainDriven.BLL.Security -{ - public interface IImpersonateObject - { - T Impersonate(string principalName); - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Extensions/SecurityOperationCodeExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Extensions/SecurityOperationCodeExtensions.cs index 8b3e95f32..518d81ca3 100644 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Extensions/SecurityOperationCodeExtensions.cs +++ b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/Extensions/SecurityOperationCodeExtensions.cs @@ -68,7 +68,7 @@ public static IReadOnlyDictionary GetDictionar private static IDictionary GetUntypeDictionary() where TSecurityOperationCode : struct, Enum { - return GetDictionary().ToDictionary(pair => (Enum)(object)pair.Key, pair => pair.Value); + return GetDictionary().ToDictionary(pair => (Enum)pair.Key, pair => pair.Value); } private static class Helper @@ -115,4 +115,4 @@ private static Dictionary Cr } } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`4.cs b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`4.cs index 803816121..52dbb2d51 100644 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`4.cs +++ b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`4.cs @@ -22,16 +22,15 @@ public abstract class SecurityBLLBaseContext dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IAccessDeniedExceptionService accessDeniedExceptionService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, [NotNull] IValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, - [NotNull] IFetchService fetchService, - [NotNull] IDateTimeService dateTimeService) - : base(serviceProvider, dalFactory, operationListeners, sourceListeners, objectStateService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService, dateTimeService) => + [NotNull] IFetchService fetchService) + : base(serviceProvider, dalFactory, operationSenders, sourceListeners, objectStateService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService) => this.AccessDeniedExceptionService = accessDeniedExceptionService ?? throw new ArgumentNullException(nameof(accessDeniedExceptionService)); diff --git a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`5.cs b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`5.cs index 3b96ef316..dc88f323d 100644 --- a/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`5.cs +++ b/src/_DomainDriven/Framework.DomainDriven.BLL.Security/SecurityBLLBaseContext`5.cs @@ -23,16 +23,15 @@ public abstract class SecurityBLLBaseContext dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IAccessDeniedExceptionService accessDeniedExceptionService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, [NotNull] IValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, - [NotNull] IFetchService fetchService, - [NotNull] IDateTimeService dateTimeService) - : base(serviceProvider, dalFactory, operationListeners, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService, dateTimeService) + [NotNull] IFetchService fetchService) + : base(serviceProvider, dalFactory, operationSenders, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService) { } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/AuditProperty/AuditPropertyPair.cs b/src/_DomainDriven/Framework.DomainDriven.Core/AuditProperty/AuditPropertyPair.cs index 058db5251..f65f0b4f0 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/AuditProperty/AuditPropertyPair.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/AuditProperty/AuditPropertyPair.cs @@ -12,9 +12,9 @@ namespace Framework.DomainDriven.Audit { public class AuditPropertyPair : IEnumerable { - private readonly IAuditProperty _authorAudit; + private readonly IAuditProperty authorAudit; - private readonly IAuditProperty _dateAudit; + private readonly IAuditProperty dateAudit; public AuditPropertyPair([NotNull] Expression> authorPropertyExpr, [NotNull] Expression> datePropertyExpr, IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) @@ -26,18 +26,15 @@ public AuditPropertyPair([NotNull] Expression> autho public AuditPropertyPair([NotNull] IAuditProperty authorAudit, [NotNull] IAuditProperty dateAudit) { - if (authorAudit == null) throw new ArgumentNullException(nameof(authorAudit)); - if (dateAudit == null) throw new ArgumentNullException(nameof(dateAudit)); - - this._authorAudit = authorAudit; - this._dateAudit = dateAudit; + this.authorAudit = authorAudit ?? throw new ArgumentNullException(nameof(authorAudit)); + this.dateAudit = dateAudit ?? throw new ArgumentNullException(nameof(dateAudit)); } public IEnumerator GetEnumerator() { - yield return this._authorAudit; - yield return this._dateAudit; + yield return this.authorAudit; + yield return this.dateAudit; } IEnumerator IEnumerable.GetEnumerator() @@ -48,9 +45,10 @@ IEnumerator IEnumerable.GetEnumerator() public class AuditPropertyPair : AuditPropertyPair { - public AuditPropertyPair(Expression> authorPropertyExpr, Expression> datePropertyExpr, - [NotNull] IUserAuthenticationService userAuthenticationService, - [NotNull] IDateTimeService dateTimeService) + public AuditPropertyPair([NotNull] IUserAuthenticationService userAuthenticationService, + [NotNull] IDateTimeService dateTimeService, + Expression> authorPropertyExpr, + Expression> datePropertyExpr) : base(authorPropertyExpr, datePropertyExpr, userAuthenticationService, dateTimeService) { } @@ -62,8 +60,8 @@ public AuditPropertyPair([NotNull] IAuditProperty authorAu } - public static AuditPropertyPair GetCreateAuditProperty(IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) => new AuditPropertyPair(obj => obj.CreatedBy, obj => obj.CreateDate, userAuthenticationService, dateTimeService); + public static AuditPropertyPair GetCreateAuditProperty(IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) => new AuditPropertyPair(userAuthenticationService, dateTimeService, obj => obj.CreatedBy, obj => obj.CreateDate); - public static AuditPropertyPair GetModifyAuditProperty(IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) => new AuditPropertyPair(obj => obj.ModifiedBy, obj => obj.ModifyDate, userAuthenticationService, dateTimeService); + public static AuditPropertyPair GetModifyAuditProperty(IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) => new AuditPropertyPair(userAuthenticationService, dateTimeService, obj => obj.ModifiedBy, obj => obj.ModifyDate); } } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/BLLBase.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/BLLBase.cs index 1f0b03a8f..6db1e0a6e 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/BLLBase.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/BLLBase.cs @@ -17,7 +17,7 @@ namespace Framework.DomainDriven.BLL { public abstract partial class BLLBase : - OperationBLLBase, + OperationBLLBase, IBLLBase diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/DefaultBLLBaseContext.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/DefaultBLLBaseContext.cs index bc727893f..966419ca1 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/DefaultBLLBaseContext.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/DefaultBLLBaseContext.cs @@ -6,7 +6,6 @@ using Framework.HierarchicalExpand; using Framework.OData; using Framework.Persistent; -using Framework.QueryableSource; using Framework.QueryLanguage; using Framework.Validation; @@ -20,9 +19,7 @@ public abstract class DefaultBLLBaseContext, - IFetchServiceContainer, - - IDateTimeServiceContainer + IFetchServiceContainer where TPersistentDomainObjectBase : class, IIdentityObject, TDomainObjectBase where TDomainObjectBase : class @@ -32,14 +29,13 @@ public abstract class DefaultBLLBaseContext /// DI interface. /// The dal factory. - /// The operation listeners. + /// The operation senders. /// The source listeners. /// The object state service. /// The standart expression builder. /// The validator. /// The hierarchical object expander factory. /// The fetch service. - /// The date time service. /// dalFactory /// or /// operationListeners @@ -58,20 +54,19 @@ public abstract class DefaultBLLBaseContext dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, [NotNull] IValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, - [NotNull] IFetchService fetchService, - [NotNull] IDateTimeService dateTimeService) + [NotNull] IFetchService fetchService) { if (objectStateService == null) throw new ArgumentNullException(nameof(objectStateService)); this.ServiceProvider = serviceProvider; this.DalFactory = dalFactory ?? throw new ArgumentNullException(nameof(dalFactory)); - this.OperationListeners = operationListeners ?? throw new ArgumentNullException(nameof(operationListeners)); + this.OperationSenders = operationSenders ?? throw new ArgumentNullException(nameof(operationSenders)); this.SourceListeners = sourceListeners ?? throw new ArgumentNullException(nameof(sourceListeners)); this.TrackingService = new TrackingService(objectStateService); @@ -82,8 +77,6 @@ protected DefaultBLLBaseContext( this.SelectOperationParser = BusinessLogicSelectOperationParser.CachedDefault; this.FetchService = fetchService ?? throw new ArgumentNullException(nameof(fetchService)); - - this.DateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); } public IValidator Validator { get; } @@ -96,7 +89,7 @@ protected DefaultBLLBaseContext( public ITrackingService TrackingService { get; } - public IBLLOperationEventListenerContainer OperationListeners { get; } + public IOperationEventSenderContainer OperationSenders { get; } public BLLSourceEventListenerContainer SourceListeners { get; } @@ -104,8 +97,6 @@ protected DefaultBLLBaseContext( public IParser SelectOperationParser { get; } - public virtual IDateTimeService DateTimeService { get; } - public IHierarchicalObjectExpanderFactory HierarchicalObjectExpanderFactory { get; } protected abstract IBLLFactoryContainer> BaseLogics { get; } @@ -120,12 +111,6 @@ public virtual bool AllowVirtualPropertyInOdata(Type domainType) public abstract bool AllowedExpandTreeParents() where TDomainObject : TPersistentDomainObjectBase; - [EditorBrowsable(EditorBrowsableState.Never)] - public IQueryableSource GetQueryableSource() - { - return new BLLQueryableSource, TPersistentDomainObjectBase, TDomainObjectBase, TIdent>(this); - } - IBLLFactoryContainer> IBLLFactoryContainerContext>>.Logics => this.BaseLogics; } @@ -141,15 +126,14 @@ public abstract class DefaultBLLBaseContext dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, [NotNull] IValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, - [NotNull] IFetchService fetchService, - [NotNull] IDateTimeService dateTimeService) - : base(serviceProvider, dalFactory, operationListeners, sourceListeners, objectStateService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService, dateTimeService) + [NotNull] IFetchService fetchService) + : base(serviceProvider, dalFactory, operationSenders, sourceListeners, objectStateService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService) { } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/IDefaultBLLContext.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/IDefaultBLLContext.cs index de200b469..efc26d57e 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/IDefaultBLLContext.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Default/IDefaultBLLContext.cs @@ -1,8 +1,6 @@ using System; -using System.ComponentModel; using Framework.Persistent; -using Framework.QueryableSource; using Framework.Validation; namespace Framework.DomainDriven.BLL @@ -13,9 +11,6 @@ public interface IDefaultBLLContext : where TPersistentDomainObjectBase : class, IIdentityObject { - [Obsolete("Please don't use!")] - [EditorBrowsable(EditorBrowsableState.Never)] - IQueryableSource GetQueryableSource(); } public interface IDefaultBLLContext : diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/EventArgs/DomainOperationEventArgs.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/EventArgs/DomainOperationEventArgs.cs index d63c09b0c..787aaa5c6 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/EventArgs/DomainOperationEventArgs.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/EventArgs/DomainOperationEventArgs.cs @@ -23,12 +23,11 @@ public class DomainOperationEventArgs : EventArgs, ID where TDomainObject : class where TOperation : struct, Enum { - public DomainOperationEventArgs(TDomainObject domainObject, Type domainObjectType, TOperation operation, IOperationBLLBase bll) + public DomainOperationEventArgs(TDomainObject domainObject, Type domainObjectType, TOperation operation) { this.DomainObject = domainObject ?? throw new ArgumentNullException(nameof(domainObject)); this.DomainObjectType = domainObjectType ?? throw new ArgumentNullException(nameof(domainObjectType)); this.Operation = operation; - this.BLL = bll; } public TDomainObject DomainObject { get; } @@ -37,9 +36,6 @@ public DomainOperationEventArgs(TDomainObject domainObject, Type domainObjectTyp public TOperation Operation { get; } - [Obsolete("Свойство больше не требуется, так как Listener-ы теперь хранятся рядом с контектом и там всегда есть возможность получить BLL из 'живого' контекста. В 7.0 свойство будет убрано.")] - public IOperationBLLBase BLL { get; } - - Enum IDomainOperationEventArgs.Operation => (Enum)(object)this.Operation; + Enum IDomainOperationEventArgs.Operation => this.Operation; } } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/BLLCustomOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/BLLCustomOperationEventListener.cs deleted file mode 100644 index 9bcb3d9c1..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/BLLCustomOperationEventListener.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Framework.DomainDriven.BLL -{ - internal sealed class BLLCustomOperationEventListener : BLLOperationEventListener - - where TDomainObject : class - where TOperation : struct, Enum - { - public BLLCustomOperationEventListener(IDictionary> cache) - : base(cache) - { - } - - internal override IEnumerable>> GetOtherEventListeners() - { - return this.GetDefaultOtherEventListeners(); - } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/BLLDefaultOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/BLLDefaultOperationEventListener.cs deleted file mode 100644 index b96224989..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/BLLDefaultOperationEventListener.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Framework.DomainDriven.BLL -{ - internal sealed class BLLDefaultOperationEventListener : BLLOperationEventListener - - where TDomainObject : class - { - public BLLDefaultOperationEventListener(IDictionary> cache) - : base(cache) - { - } - - - internal override IEnumerable>> GetOtherEventListeners() - { - return this.GetDefaultOtherEventListeners(); - } - - //internal override IEnumerable> GetOtherEventListeners() - //{ - // return this.GetDefaultOtherEventListeners(); - // //var request1 = from pairListener in this.Cache - - // // where pairListener.Key.IsAssignableFrom(typeof(TDomainObject)) - - // // from listener in pairListener.Value - - // // where listener. - - // // sele - - - - - // //return this.Cache[typeof (TDomainObject)] - // // .Where(listenerPair => listenerPair.Value != this) - // // .SelectMany(otherListener => otherListener.Value.GetDefaultOtherEventListeners()) - // // .Distinct(pair => pair.Value); - //} - } -} - - // TDomain | BLLBaseOperation - - // / \ - // / \ - // / \ - // / \ - // / \ - // / \ - // / \ - // / \ - - //Invoice | BLLBaseOperation TDomain | TOperation - - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - // \ / - - // Invoice | TOperation \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/BLLOperationEventListenerContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/BLLOperationEventListenerContainer.cs deleted file mode 100644 index 9858468b7..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/BLLOperationEventListenerContainer.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; - -using Framework.Core; - -namespace Framework.DomainDriven.BLL -{ - public sealed class BLLOperationEventListenerContainer : IBLLOperationEventListenerContainer - where TDomainObjectBase : class - { - private readonly object _locker = new object(); - - private readonly IDictionary> _cache = new Dictionary>(); - - - - public BLLOperationEventListener GetEventListener() - where TDomainObject : class, TDomainObjectBase - { - return this.GetEventListener(); - } - - public BLLOperationEventListener GetEventListener() - where TDomainObject : class, TDomainObjectBase - where TOperation : struct, Enum - { - lock (this._locker) - { - return this._cache.GetValueOrCreate(typeof(TDomainObject), () => new Dictionary()).Pipe(domainCache => - { - var lazyBaseEventListener = LazyHelper.Create(() => domainCache.GetValueOrCreate(typeof(BLLBaseOperation), () => new BLLDefaultOperationEventListener(this._cache)) as BLLDefaultOperationEventListener); - - if (typeof(TOperation) == typeof(BLLBaseOperation)) - { - return lazyBaseEventListener.Value; - } - else - { - return domainCache.GetValueOrCreate(typeof(TOperation), () => - new BLLCustomOperationEventListener(this._cache)); - } - }) as BLLOperationEventListener; - } - } - - #region IBLLOperationEventListenerContainer Members - - BLLOperationEventListener IBLLOperationEventListenerContainer.GetEventListener() - { - return this.GetEventListener(); - } - - BLLOperationEventListener IBLLOperationEventListenerContainer.GetEventListener() - { - return this.GetEventListener(); - } - - #endregion - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/IBLLOperationEventListenerContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/IBLLOperationEventListenerContainer.cs deleted file mode 100644 index 42c1f3d56..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/IBLLOperationEventListenerContainer.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -namespace Framework.DomainDriven.BLL -{ - public interface IBLLOperationEventListenerContainer - { - BLLOperationEventListener GetEventListener() - where TDomainObject : class, TDomainObjectBase; - - BLLOperationEventListener GetEventListener() - where TDomainObject : class, TDomainObjectBase - where TOperation : struct, Enum; - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/IOperationEventSenderContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/IOperationEventSenderContainer.cs new file mode 100644 index 000000000..feeca591d --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/IOperationEventSenderContainer.cs @@ -0,0 +1,14 @@ +using System; + +namespace Framework.DomainDriven.BLL +{ + public interface IOperationEventSenderContainer + { + OperationEventSender GetEventSender() + where TDomainObject : class, TPersistentDomainObjectBase; + + OperationEventSender GetEventSender() + where TDomainObject : class, TPersistentDomainObjectBase + where TOperation : struct, Enum; + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/OperationEventSenderContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/OperationEventSenderContainer.cs new file mode 100644 index 000000000..3f11ea89b --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/Container/OperationEventSenderContainer.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Framework.Core; + +using JetBrains.Annotations; + +namespace Framework.DomainDriven.BLL +{ + public sealed class OperationEventSenderContainer : IOperationEventSenderContainer + where TPersistentDomainObjectBase : class + { + private readonly IEnumerable> eventListeners; + + private readonly object _locker = new object(); + + private readonly IDictionary> _cache = new Dictionary>(); + + + public OperationEventSenderContainer([NotNull] IEnumerable> eventListeners) + { + this.eventListeners = (eventListeners ?? throw new ArgumentNullException(nameof(eventListeners))).ToArray(); + } + + + public OperationEventSender GetEventListener() + where TDomainObject : class, TPersistentDomainObjectBase + { + return this.GetEventListener(); + } + + public OperationEventSender GetEventListener() + where TDomainObject : class, TPersistentDomainObjectBase + where TOperation : struct, Enum + { + lock (this._locker) + { + return this._cache.GetValueOrCreate(typeof(TDomainObject), () => new Dictionary()).Pipe(domainCache => + { + var lazyBaseEventListener = LazyHelper.Create(() => domainCache.GetValueOrCreate(typeof(BLLBaseOperation), () => new DefaultOperationEventSender(this.eventListeners, this._cache)) as DefaultOperationEventSender); + + if (typeof(TOperation) == typeof(BLLBaseOperation)) + { + return lazyBaseEventListener.Value; + } + else + { + return domainCache.GetValueOrCreate(typeof(TOperation), () => + new CustomOperationEventSender(this.eventListeners, this._cache)); + } + }) as OperationEventSender; + } + } + + #region IBLLOperationEventListenerContainer Members + + OperationEventSender IOperationEventSenderContainer.GetEventSender() + { + return this.GetEventListener(); + } + + OperationEventSender IOperationEventSenderContainer.GetEventSender() + { + return this.GetEventListener(); + } + + #endregion + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/CustomOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/CustomOperationEventListener.cs new file mode 100644 index 000000000..7c340592d --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/CustomOperationEventListener.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +namespace Framework.DomainDriven.BLL +{ + internal sealed class CustomOperationEventSender : OperationEventSender + + where TDomainObject : class + where TOperation : struct, Enum + { + public CustomOperationEventSender(IEnumerable> eventListeners, IDictionary> cache) + : base(eventListeners, cache) + { + } + + internal override IEnumerable>> GetOtherEventListeners() + { + return this.GetDefaultOtherEventListeners(); + } + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/DefaultOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/DefaultOperationEventListener.cs new file mode 100644 index 000000000..cd8fc277a --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/DefaultOperationEventListener.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; + +namespace Framework.DomainDriven.BLL +{ + internal sealed class DefaultOperationEventSender : OperationEventSender + + where TDomainObject : class + { + public DefaultOperationEventSender(IEnumerable> eventListeners, IDictionary> cache) + : base(eventListeners, cache) + { + } + + internal override IEnumerable>> GetOtherEventListeners() + { + return this.GetDefaultOtherEventListeners(); + } + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/BLLOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/BLLOperationEventListener.cs deleted file mode 100644 index 8f2a4fb8d..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/BLLOperationEventListener.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Framework.Core; - -namespace Framework.DomainDriven.BLL -{ - public abstract class BLLOperationEventListener - { - internal abstract IEnumerable>> GetOtherEventListeners(); - - internal abstract IEnumerable>> GetDefaultOtherEventListeners(); - } - - public abstract class BLLOperationEventListener : BLLOperationEventListener, IBLLOperationEventListener - where TDomainObject : class - where TOperation : struct, Enum - { - protected readonly IDictionary> Cache; - - - internal BLLOperationEventListener(IDictionary> cache) - { - this.Cache = cache ?? throw new ArgumentNullException(nameof(cache)); - } - - - protected void ProcessOtherEventListeners(DomainOperationEventArgs eventArgs) - { - var processOtherEventListenerMethod = new Action> (eventArgs.ProcessOtherEventListener).Method.GetGenericMethodDefinition(); - - foreach (var otherListener in this.GetOtherEventListeners()) - { - processOtherEventListenerMethod.MakeGenericMethod(typeof(TDomainObject), typeof(TOperation), otherListener.Key, otherListener.Value.Key) - .Invoke(null, new object[] { eventArgs, otherListener.Value.Value }); - } - } - - internal sealed override IEnumerable>> GetDefaultOtherEventListeners() - { - return from processedDomainTypePair in this.Cache - - let processedDomainType = processedDomainTypePair.Key - - where processedDomainType.IsAssignableFrom(typeof(TDomainObject)) - - from listenerPair in processedDomainTypePair.Value - - where listenerPair.Value != this - - select processedDomainType.ToKeyValuePair(listenerPair); - } - - /// - public void ForceEvent(TDomainObject domainObject, TOperation operation) - { - this.RaiseOperationProcessed(domainObject, operation, null); - } - - internal void RaiseOperationProcessed(TDomainObject domainObject, TOperation operation, IOperationBLLBase bll) - { - this.RaiseOperationProcessed(new DomainOperationEventArgs(domainObject, typeof(TDomainObject), operation, bll)); - } - - protected internal virtual void RaiseOperationProcessed(DomainOperationEventArgs eventArgs, bool isStart) - { - if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); - - this.OperationProcessed.Maybe(handler => handler(this, eventArgs)); - - if (isStart) - { - this.ProcessOtherEventListeners(eventArgs); - } - } - - internal void RaiseOperationProcessed(DomainOperationEventArgs eventArgs) - { - if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); - - this.RaiseOperationProcessed(eventArgs, true); - } - - - public event EventHandler> OperationProcessed; - - - protected static readonly bool IsImplemented = !typeof (TDomainObject).IsAbstract; - } - - public static class BLLOperationEventListenerExtensions - { - public static void ProcessOtherEventListener(this DomainOperationEventArgs eventArgs, BLLOperationEventListener otherListener) - where TOtherOperation : struct, Enum - where TOtherDomainObject : class - where TDomainObject : class, TOtherDomainObject - where TOperation : struct, Enum - { - OperationConverter.Map.GetMaybeValue(eventArgs.Operation).Match(otherOperation => - { - var newEventArgs = new DomainOperationEventArgs(eventArgs.DomainObject, typeof(TDomainObject), otherOperation, eventArgs.BLL as IOperationBLLBase); - - otherListener.RaiseOperationProcessed(newEventArgs, false); - }); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/DomainOperationEventArgsExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/DomainOperationEventArgsExtensions.cs new file mode 100644 index 000000000..c20013b80 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/DomainOperationEventArgsExtensions.cs @@ -0,0 +1,22 @@ +using System; + +using Framework.Core; + +namespace Framework.DomainDriven.BLL; + +public static class DomainOperationEventArgsExtensions +{ + public static void ProcessOtherEventListener(this IDomainOperationEventArgs eventArgs, OperationEventSender otherListener) + where TOtherOperation : struct, Enum + where TOtherDomainObject : class + where TDomainObject : class, TOtherDomainObject + where TOperation : struct, Enum + { + OperationConverter.Map.GetMaybeValue(eventArgs.Operation).Match(otherOperation => + { + var newEventArgs = new DomainOperationEventArgs(eventArgs.DomainObject, typeof(TDomainObject), otherOperation); + + otherListener.SendEvent(newEventArgs, false); + }); + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IBLLOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IBLLOperationEventListener.cs deleted file mode 100644 index 495d927f3..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IBLLOperationEventListener.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Framework.DomainDriven.BLL -{ - public interface IBLLOperationEventListener : IForceEventContainer - where TDomainObject : class - where TOperation : struct, Enum - { - event EventHandler> OperationProcessed; - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IForceEventContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IOperationEventSender.cs similarity index 54% rename from src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IForceEventContainer.cs rename to src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IOperationEventSender.cs index 2cd2907e6..de710bbe6 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IForceEventContainer.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/IOperationEventSender.cs @@ -7,15 +7,10 @@ namespace Framework.DomainDriven.BLL /// /// Тип доменного объекта /// Тип операции - public interface IForceEventContainer + public interface IOperationEventSender where TDomainObject : class where TOperation : struct, Enum { - /// - /// Ручное инициирование события - /// - /// Доменный объект - /// Операция - void ForceEvent(TDomainObject domainObject, TOperation operation); + void SendEvent(IDomainOperationEventArgs eventArgs); } } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/OperationEventSender.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/OperationEventSender.cs new file mode 100644 index 000000000..6d86d2de4 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/OperationEventSender.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Framework.Core; + +namespace Framework.DomainDriven.BLL +{ + public abstract class OperationEventSender + { + internal abstract IEnumerable>> GetOtherEventListeners(); + + internal abstract IEnumerable>> GetDefaultOtherEventListeners(); + } + + public abstract class OperationEventSender : OperationEventSender, IOperationEventSender + where TDomainObject : class + where TOperation : struct, Enum + { + private readonly IEnumerable> eventListeners; + + protected readonly IDictionary> Cache; + + + internal OperationEventSender(IEnumerable> eventListeners, IDictionary> cache) + { + this.eventListeners = eventListeners; + this.Cache = cache ?? throw new ArgumentNullException(nameof(cache)); + } + + + protected void ProcessOtherEventListeners(IDomainOperationEventArgs eventArgs) + { + var processOtherEventListenerMethod = new Action> (eventArgs.ProcessOtherEventListener).Method.GetGenericMethodDefinition(); + + foreach (var otherListener in this.GetOtherEventListeners()) + { + processOtherEventListenerMethod.MakeGenericMethod(typeof(TDomainObject), typeof(TOperation), otherListener.Key, otherListener.Value.Key) + .Invoke(null, new object[] { eventArgs, otherListener.Value.Value }); + } + } + + internal sealed override IEnumerable>> GetDefaultOtherEventListeners() + { + return from processedDomainTypePair in this.Cache + + let processedDomainType = processedDomainTypePair.Key + + where processedDomainType.IsAssignableFrom(typeof(TDomainObject)) + + from listenerPair in processedDomainTypePair.Value + + where listenerPair.Value != this + + select processedDomainType.ToKeyValuePair(listenerPair); + } + + public void SendEvent(IDomainOperationEventArgs eventArgs) + { + if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); + + this.SendEvent(eventArgs, true); + } + + protected internal virtual void SendEvent(IDomainOperationEventArgs eventArgs, bool isStart) + { + if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); + + this.eventListeners.Foreach(eventListener => eventListener.OnFired(eventArgs)); + + if (isStart) + { + this.ProcessOtherEventListeners(eventArgs); + } + } + + + protected static readonly bool IsImplemented = !typeof (TDomainObject).IsAbstract; + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/OperationEventSenderExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/OperationEventSenderExtensions.cs new file mode 100644 index 000000000..c7702cb9e --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/Events/Operation/_Base/OperationEventSenderExtensions.cs @@ -0,0 +1,13 @@ +using System; + +namespace Framework.DomainDriven.BLL; + +public static class OperationEventSenderExtensions +{ + public static void SendEvent(this IOperationEventSender eventSender, TDomainObject domainObject, TOperation operation) + where TDomainObject : class + where TOperation : struct, Enum + { + eventSender.SendEvent(new DomainOperationEventArgs(domainObject, typeof(TDomainObject), operation)); + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLBaseContext.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLBaseContext.cs index 4471ea186..f6561a3df 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLBaseContext.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLBaseContext.cs @@ -11,7 +11,7 @@ public interface IBLLBaseContextBase } - public interface IBLLBaseContext : IBLLBaseContextBase, IBLLOperationEventContext, IBLLSourceEventContext, IODataBLLContext + public interface IBLLBaseContext : IBLLBaseContextBase, IBLLOperationEventContext, IBLLSourceEventContext, IODataBLLContext where TPersistentDomainObjectBase : class, IIdentityObject, TDomainObjectBase where TDomainObjectBase : class diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLOperationEventContext.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLOperationEventContext.cs index cae9dc394..549da41fc 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLOperationEventContext.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/IBLLOperationEventContext.cs @@ -3,13 +3,13 @@ /// /// Интерфейс объекта содержащего контейнер слушателей BLL-ных событий /// - /// Тип доменного объекта - public interface IBLLOperationEventContext - where TDomainObjectBase : class + /// Тип доменного объекта + public interface IBLLOperationEventContext + where TPersistentDomainObjectBase : class { /// - /// Возвращается контейнер слушателей BLL-ных событий + /// Возвращается контейнер отправителя BLL-ных событий /// - IBLLOperationEventListenerContainer OperationListeners { get; } + IOperationEventSenderContainer OperationSenders { get; } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/OperationBLLBase.cs b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/OperationBLLBase.cs index 043b556e6..3c3fc292b 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/BLL/OperationBLLBase.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/BLL/OperationBLLBase.cs @@ -1,36 +1,38 @@ using System; -using Framework.Core; namespace Framework.DomainDriven.BLL { - public abstract class OperationBLLBase : BLLContextContainer, IOperationBLLBase + public abstract class OperationBLLBase : BLLContextContainer, IOperationBLLBase + + where TPersistentDomainObjectBase : class, TDomainObjectBase where TDomainObjectBase : class - where TDomainObject : class, TDomainObjectBase + + where TDomainObject : class, TPersistentDomainObjectBase where TOperation : struct, Enum - where TBLLContext : class, IBLLOperationEventContext + where TBLLContext : class, IBLLOperationEventContext { - private readonly Lazy> _lazyOperationListener; + private readonly Lazy> _lazyOperationSender; - private readonly Lazy> _lazyDefaultOperationListener; + private readonly Lazy> _lazyDefaultOperationSender; protected OperationBLLBase(TBLLContext context) : base(context) { - this._lazyOperationListener = LazyHelper.Create(() => this.Context.OperationListeners.GetEventListener()); - this._lazyDefaultOperationListener = LazyHelper.Create(() => this.Context.OperationListeners.GetEventListener()); + this._lazyOperationSender = new Lazy>(() => this.Context.OperationSenders.GetEventSender()); + this._lazyDefaultOperationSender = new Lazy>(() => this.Context.OperationSenders.GetEventSender()); } - private BLLOperationEventListener OperationListener + private IOperationEventSender OperationSender { - get { return this._lazyOperationListener.Value; } + get { return this._lazyOperationSender.Value; } } - private BLLOperationEventListener DefaultOperationListener + private IOperationEventSender DefaultOperationSender { - get { return this._lazyDefaultOperationListener.Value; } + get { return this._lazyDefaultOperationSender.Value; } } @@ -38,28 +40,28 @@ public virtual void Save(TDomainObject domainObject) { if (domainObject == null) throw new ArgumentNullException(nameof(domainObject)); - this.DefaultOperationListener.RaiseOperationProcessed(domainObject, BLLBaseOperation.Save, this); + this.DefaultOperationSender.SendEvent(domainObject, BLLBaseOperation.Save); } public virtual void Remove(TDomainObject domainObject) { if (domainObject == null) throw new ArgumentNullException(nameof(domainObject)); - this.DefaultOperationListener.RaiseOperationProcessed(domainObject, BLLBaseOperation.Remove, this); + this.DefaultOperationSender.SendEvent(domainObject, BLLBaseOperation.Remove); } protected void RaiseOperationProcessed(TDomainObject domainObject, TOperation operation) { if (domainObject == null) throw new ArgumentNullException(nameof(domainObject)); - this.OperationListener.RaiseOperationProcessed(domainObject, operation, this); + this.OperationSender.SendEvent(domainObject, operation); } - protected void RaiseOperationProcessed(DomainOperationEventArgs eventArgs) + protected void RaiseOperationProcessed(IDomainOperationEventArgs eventArgs) { if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); - this.OperationListener.RaiseOperationProcessed(eventArgs); + this.OperationSender.SendEvent(eventArgs); } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/DAL/Revisions/AuditRevisionEntity.cs b/src/_DomainDriven/Framework.DomainDriven.Core/DAL/Revisions/AuditRevisionEntity.cs index cd85444ca..4e213bff8 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/DAL/Revisions/AuditRevisionEntity.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/DAL/Revisions/AuditRevisionEntity.cs @@ -5,7 +5,9 @@ namespace Framework.DomainDriven.DAL.Revisions public class AuditRevisionEntity { public virtual string Author { get; set; } + public virtual long Id { get; protected internal set; } + public virtual DateTime RevisionDate { get; protected internal set; } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/DateTimeService/IDateTimeServiceContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/DateTimeService/IDateTimeServiceContainer.cs deleted file mode 100644 index 930133403..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/DateTimeService/IDateTimeServiceContainer.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Framework.DomainDriven -{ - public interface IDateTimeServiceContainer - { - IDateTimeService DateTimeService { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Framework.DomainDriven.Core.csproj b/src/_DomainDriven/Framework.DomainDriven.Core/Framework.DomainDriven.Core.csproj index 3a8a6d8e0..b02a3dd23 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Framework.DomainDriven.Core.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Framework.DomainDriven.Core.csproj @@ -19,5 +19,6 @@ + diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/ContextEvaluatorExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/ContextEvaluatorExtensions.cs index 18e7d1ea9..2ef7c8410 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/ContextEvaluatorExtensions.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/ContextEvaluatorExtensions.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using JetBrains.Annotations; @@ -14,9 +15,9 @@ public static void Evaluate( context.Evaluate(sessionMode, action.ToDefaultFunc()); } - public static void Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, string principalName, [NotNull] Action action) + public static void Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, string customPrincipalName, [NotNull] Action action) { - context.Evaluate(sessionMode, principalName, action.ToDefaultFunc()); + context.Evaluate(sessionMode, customPrincipalName, action.ToDefaultFunc()); } public static TResult Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, [NotNull] Func getResult) @@ -29,9 +30,9 @@ public static void Evaluate(this IContextEvaluator con context.Evaluate(sessionMode, null, action); } - public static void Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, string principalName, [NotNull] Action action) + public static void Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, string customPrincipalName, [NotNull] Action action) { - context.Evaluate(sessionMode, principalName, action.ToDefaultFunc()); + context.Evaluate(sessionMode, customPrincipalName, action.ToDefaultFunc()); } public static TResult Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, [NotNull] Func getResult) @@ -39,9 +40,19 @@ public static TResult Evaluate(this IContextEvaluator(this IContextEvaluator context, DBSessionMode sessionMode, string principalName, [NotNull] Func getResult) + public static TResult Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, string customPrincipalName, [NotNull] Func getResult) { - return context.Evaluate(sessionMode, principalName, (c, _) => getResult(c)); + return context.Evaluate(sessionMode, customPrincipalName, (c, _) => getResult(c)); + } + + public static TResult Evaluate(this IContextEvaluator context, DBSessionMode sessionMode, string customPrincipalName, [NotNull] Func getResult) + { + return context.EvaluateAsync(sessionMode, customPrincipalName, (c, s) => Task.FromResult(getResult (c, s))).Result; + } + + public static Task EvaluateAsync(this IContextEvaluator context, DBSessionMode sessionMode, [NotNull] Func> getResult) + { + return context.EvaluateAsync(sessionMode, null, getResult); } private static Func ToDefaultFunc(this Action action) diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/EmptyDALListenter.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/EmptyDALListenter.cs deleted file mode 100644 index 7a4e675d7..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/EmptyDALListenter.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Framework.DomainDriven.BLL; - -namespace Framework.DomainDriven.BLL -{ - public class EmptyDALListenter : IDALListener - { - public static readonly EmptyDALListenter Instance = new EmptyDALListenter(); - - private EmptyDALListenter() - { - } - - public void Process(DALChangesEventArgs eventArgs) - { - } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IAfterTransactionCompletedDALListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IAfterTransactionCompletedDALListener.cs new file mode 100644 index 000000000..850a223d8 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IAfterTransactionCompletedDALListener.cs @@ -0,0 +1,5 @@ +namespace Framework.DomainDriven.BLL; + +public interface IAfterTransactionCompletedDALListener : IDALListener +{ +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IBeforeTransactionCompletedDALListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IBeforeTransactionCompletedDALListener.cs new file mode 100644 index 000000000..b2e043945 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IBeforeTransactionCompletedDALListener.cs @@ -0,0 +1,5 @@ +namespace Framework.DomainDriven.BLL; + +public interface IBeforeTransactionCompletedDALListener : IDALListener +{ +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IFlushedDALListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IFlushedDALListener.cs new file mode 100644 index 000000000..4c8c5c63e --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/DALListener/IFlushedDALListener.cs @@ -0,0 +1,5 @@ +namespace Framework.DomainDriven.BLL; + +public interface IFlushedDALListener : IDALListener +{ +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IContextEvaluator.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IContextEvaluator.cs index a24cc3cc8..1a2f2fddd 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IContextEvaluator.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IContextEvaluator.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using JetBrains.Annotations; @@ -6,6 +7,6 @@ namespace Framework.DomainDriven.BLL { public interface IContextEvaluator { - TResult Evaluate(DBSessionMode sessionMode, string principalName, [NotNull] Func getResult); + Task EvaluateAsync(DBSessionMode sessionMode, string customPrincipalName, [NotNull] Func> getResult); } } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/ICurrentRevisionService.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/ICurrentRevisionService.cs new file mode 100644 index 000000000..d63e2038a --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/ICurrentRevisionService.cs @@ -0,0 +1,11 @@ +namespace Framework.DomainDriven.BLL; + +public interface ICurrentRevisionService +{ + + /// + /// Получение текущей ревизии из аудита (пока возвращает 0, если вызван до флаша сессии) + /// + /// + long GetCurrentRevision(); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSession.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSession.cs index 71ea43942..25bb7679c 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSession.cs +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSession.cs @@ -6,29 +6,9 @@ namespace Framework.DomainDriven.BLL { - public interface IDBSession + public interface IDBSession : ICurrentRevisionService, IDisposable { - event EventHandler Closed; - - [Obsolete("Use AfterTransactionCompleted", true)] - event EventHandler TransactionCompleted; - - /// - /// Евент срабатывает циклично, пока происходят изменения доменных объектов - /// - event EventHandler Flushed; - - /// - /// Евент срабатывает только 1 раз перед закрытием сессии, изменения в базу в этот момент разрешены - /// - event EventHandler BeforeTransactionCompleted; - - /// - /// Евент срабатывает только 1 раз перед закрытием сессии, изменения в базу в этот момент запрещены - /// - event EventHandler AfterTransactionCompleted; - - TResult Evaluate(Func getResult); + DBSessionMode SessionMode { get; } IObjectStateService GetObjectStateService(); @@ -40,12 +20,6 @@ IDALFactory GetDALFactory void Flush(); - /// - /// Получение текущей ревизии из аудита (пока возвращает 0, если вызван до флаша сессии) - /// - /// - long GetCurrentRevision(); - IEnumerable GetModifiedObjectsFromLogic(); IEnumerable GetModifiedObjectsFromLogic(); @@ -53,12 +27,24 @@ IDALFactory GetDALFactory /// Закрывает текущую транзакцию без применения изменений. /// - void ManualFault(); + void AsFault(); /// /// Gets the maximum audit revision. /// /// System.Int64. long GetMaxRevision(); + + /// + /// Перевод сессию в режим "только для чтения" (доступно только перед фактическим использованием сессии) + /// + void AsReadOnly(); + + /// + /// Переводит сессию в режим для записи (доступно только перед фактическим использованием сессии) + /// + void AsWritable(); + + void Close(); } } diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionEventListener.cs new file mode 100644 index 000000000..75cd8e575 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionEventListener.cs @@ -0,0 +1,12 @@ +using System; + +namespace Framework.DomainDriven.BLL; + +public interface IDBSessionEventListener +{ + void OnFlushed(DALChangesEventArgs eventArgs); + + void OnBeforeTransactionCompleted(DALChangesEventArgs eventArgs); + + void OnAfterTransactionCompleted(DALChangesEventArgs eventArgs); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionFactory.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionFactory.cs deleted file mode 100644 index 190e9ca98..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionFactory.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; - -using Framework.Core; - -using JetBrains.Annotations; - -namespace Framework.DomainDriven.BLL -{ - public interface IDBSessionFactory : IFactory, IDisposable - { - AvailableValues AvailableValues { get; } - - event EventHandler SessionFlushed; - } - - public static class DBSessionFactoryExtensions - { - public static void Evaluate([NotNull] this IFactory sessionFactory, - DBSessionMode sessionMode, [NotNull] Action action) - { - if (sessionFactory == null) throw new ArgumentNullException(nameof(sessionFactory)); - if (action == null) throw new ArgumentNullException(nameof(action)); - - sessionFactory.Evaluate(sessionMode, context => - { - action(context); - return default(object); - }); - } - - public static TResult Evaluate([NotNull] this IFactory sessionFactory, - DBSessionMode sessionMode, [NotNull] Func getResult) - { - if (sessionFactory == null) throw new ArgumentNullException(nameof(sessionFactory)); - if (getResult == null) throw new ArgumentNullException(nameof(getResult)); - - return sessionFactory.Create(sessionMode).Evaluate(getResult); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionFactoryContainer.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionFactoryContainer.cs deleted file mode 100644 index 8ea2a097c..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IDBSessionFactoryContainer.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Framework.DomainDriven.BLL -{ - public interface IDBSessionFactoryContainer - { - IDBSessionFactory SessionFactory { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IOperationEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IOperationEventListener.cs new file mode 100644 index 000000000..0118ef282 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IOperationEventListener.cs @@ -0,0 +1,11 @@ +using System; + +namespace Framework.DomainDriven.BLL; + +public interface IOperationEventListener + where TPersistentDomainObjectBase : class +{ + void OnFired(IDomainOperationEventArgs eventArgs) + where TDomainObject : class, TPersistentDomainObjectBase + where TOperation : struct, Enum; +} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IScopedContextEvaluator.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/IScopedContextEvaluator.cs deleted file mode 100644 index dc439a65e..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.Core/Session/IScopedContextEvaluator.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Framework.DomainDriven.BLL; - -public interface IScopedContextEvaluator : IContextEvaluator -{ -} diff --git a/src/_DomainDriven/Framework.DomainDriven.Core/Session/ServiceProviderExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.Core/Session/ServiceProviderExtensions.cs new file mode 100644 index 000000000..f62539bb2 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.Core/Session/ServiceProviderExtensions.cs @@ -0,0 +1,44 @@ +using System; + +using JetBrains.Annotations; + +using Microsoft.Extensions.DependencyInjection; + +namespace Framework.DomainDriven.BLL; + +public static class ServiceProviderExtensions +{ + /// + /// Попытка закрыть текущую бд-сессию (если она существует) и вызывать механизм сброса евентов в DALListener-ы + /// + /// + /// + public static void TryCloseDbSession([NotNull] this IServiceProvider serviceProvider) + { + if (serviceProvider == null) throw new ArgumentNullException(nameof(serviceProvider)); + + var lazyDbSession = serviceProvider.GetRequiredService>(); + + if (lazyDbSession.IsValueCreated) + { + lazyDbSession.Value.Close(); + } + } + + /// + /// Попытка промаркировать текущую бд-сессию (если она существует), что случилась ошибка и ничего в базу записывать не нужно. + /// + /// + /// + public static void TryFaultDbSession([NotNull] this IServiceProvider serviceProvider) + { + if (serviceProvider == null) throw new ArgumentNullException(nameof(serviceProvider)); + + var lazyDbSession = serviceProvider.GetRequiredService>(); + + if (lazyDbSession.IsValueCreated) + { + lazyDbSession.Value.AsFault(); + } + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.DAL.Sql/Framework.DomainDriven.DAL.Sql.csproj b/src/_DomainDriven/Framework.DomainDriven.DAL.Sql/Framework.DomainDriven.DAL.Sql.csproj index d38aff7be..282d9e405 100644 --- a/src/_DomainDriven/Framework.DomainDriven.DAL.Sql/Framework.DomainDriven.DAL.Sql.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.DAL.Sql/Framework.DomainDriven.DAL.Sql.csproj @@ -3,7 +3,7 @@ Luxoft.Framework.DomainDriven.DAL.Sql - + diff --git a/src/_DomainDriven/Framework.DomainDriven.DBGenerator.Tests.Unit/Framework.DomainDriven.DBGenerator.Tests.Unit.csproj b/src/_DomainDriven/Framework.DomainDriven.DBGenerator.Tests.Unit/Framework.DomainDriven.DBGenerator.Tests.Unit.csproj index e25457769..fdec271b3 100644 --- a/src/_DomainDriven/Framework.DomainDriven.DBGenerator.Tests.Unit/Framework.DomainDriven.DBGenerator.Tests.Unit.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.DBGenerator.Tests.Unit/Framework.DomainDriven.DBGenerator.Tests.Unit.csproj @@ -4,10 +4,10 @@ - - - - + + + + diff --git a/src/_DomainDriven/Framework.DomainDriven.DBGenerator/AuditDBGenerator/AuditDatabaseScriptGenerator.cs b/src/_DomainDriven/Framework.DomainDriven.DBGenerator/AuditDBGenerator/AuditDatabaseScriptGenerator.cs index d0e0cefa5..20c8263ba 100644 --- a/src/_DomainDriven/Framework.DomainDriven.DBGenerator/AuditDBGenerator/AuditDatabaseScriptGenerator.cs +++ b/src/_DomainDriven/Framework.DomainDriven.DBGenerator/AuditDBGenerator/AuditDatabaseScriptGenerator.cs @@ -258,7 +258,7 @@ private Configuration CreateConfiguration(string auditDbName, IDatabaseScriptGen ms.InitMapping(cfg); } - cfg.InitializeAudit(overrideMappingSettings, context.UserAuthenticationService); + cfg.InitializeAudit(overrideMappingSettings, LazyInterfaceImplementHelper.CreateNotImplemented()); SchemaMetadataUpdater.QuoteTableAndColumns(cfg, Dialect.GetDialect(cfg.Properties)); diff --git a/src/_DomainDriven/Framework.DomainDriven.DBGenerator/Framework.DomainDriven.DBGenerator.csproj b/src/_DomainDriven/Framework.DomainDriven.DBGenerator/Framework.DomainDriven.DBGenerator.csproj index f32cfaa15..5f5d9405f 100644 --- a/src/_DomainDriven/Framework.DomainDriven.DBGenerator/Framework.DomainDriven.DBGenerator.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.DBGenerator/Framework.DomainDriven.DBGenerator.csproj @@ -3,7 +3,7 @@ Luxoft.Framework.DomainDriven.DBGenerator - + diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate.DALGenerator/Framework.DomainDriven.NHibernate.DALGenerator.csproj b/src/_DomainDriven/Framework.DomainDriven.NHibernate.DALGenerator/Framework.DomainDriven.NHibernate.DALGenerator.csproj index 59155da61..eb14e5e53 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate.DALGenerator/Framework.DomainDriven.NHibernate.DALGenerator.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate.DALGenerator/Framework.DomainDriven.NHibernate.DALGenerator.csproj @@ -3,7 +3,7 @@ Luxoft.Framework.DomainDriven.NHibernate.DALGenerator - + diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AuditMetadataProvider.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AuditMetadataProvider.cs index d7caecbd5..7dc3de230 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AuditMetadataProvider.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AuditMetadataProvider.cs @@ -73,7 +73,7 @@ public AuditMetadataProvider( nhConfiguration.AddMapping(this.CreateRevisionInfoMappingDocument()); - var auditAttributeSerivce = this.mappingSettings.GetAuditAttributeService(nhConfiguration.ClassMappings); + var auditAttributeService = this.mappingSettings.GetAuditAttributeService(nhConfiguration.ClassMappings); var auditedTypes = this.mappingSettings .SelectMany( @@ -95,10 +95,10 @@ public AuditMetadataProvider( { var persistentClass = pair.PersistentClass; - var propertyInterator = persistentClass.PropertyIterator; + var propertyIterator = persistentClass.PropertyIterator; - this.AddForEntity(persistentClass, ret, auditAttributeSerivce); - this.AddForComponent(propertyInterator, ret, auditAttributeSerivce); + this.AddForEntity(persistentClass, ret, auditAttributeService); + this.AddForComponent(propertyIterator, ret, auditAttributeService); } var auditRevisionType = typeof(TAuditRevisionEntity); diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AudtiRevisionEntityListener.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AudtiRevisionEntityListener.cs index 1a6e4e966..809ef288c 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AudtiRevisionEntityListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/AudtiRevisionEntityListener.cs @@ -1,7 +1,5 @@ using System; -using Framework.Core; -using Framework.Core.Services; using Framework.DomainDriven.DAL.Revisions; using NHibernate.Envers; @@ -14,8 +12,8 @@ namespace Framework.DomainDriven.NHibernate.Audit public class AuditRevisionEntityListener : RevisionEntityListener where TAuditRevisionEntity : AuditRevisionEntity { - public AuditRevisionEntityListener(IUserAuthenticationService userAuthenticationService) - : base(userAuthenticationService) + public AuditRevisionEntityListener(IAuditRevisionUserAuthenticationService auditRevisionUserAuthenticationService) + : base(auditRevisionUserAuthenticationService) { } @@ -31,7 +29,7 @@ protected override void ProcessEntityChanged(Type entityClass, object entityId, private void SetAuthor(TAuditRevisionEntity revisionEntity) { - revisionEntity.Author = this.UserAuthenticationService.GetUserName(); + revisionEntity.Author = this.AuditRevisionUserAuthenticationService.GetUserName(); } } } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/CreateAuditEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/CreateAuditEventListener.cs index 00b2c36fc..4785686c5 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/CreateAuditEventListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/CreateAuditEventListener.cs @@ -2,7 +2,6 @@ using System.Threading; using System.Threading.Tasks; -using Framework.Core.Services; using Framework.DomainDriven.Audit; using NHibernate.Event; @@ -15,11 +14,8 @@ public class CreateAuditEventListener : AuditEventListenerBase, IPreInsertEventL public CreateAuditEventListener(IEnumerable auditProperties) : base(auditProperties) { - } - public static CreateAuditEventListener Create(IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) => new CreateAuditEventListener(AuditPropertyPair.GetCreateAuditProperty(userAuthenticationService, dateTimeService)); - public Task OnPreInsertAsync(PreInsertEvent @event, CancellationToken cancellationToken) { this.SetAuditFields(@event, @event.State); diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/IAuditRevisionUserAuthenticationService.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/IAuditRevisionUserAuthenticationService.cs new file mode 100644 index 000000000..26c4967da --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/IAuditRevisionUserAuthenticationService.cs @@ -0,0 +1,6 @@ +namespace Framework.DomainDriven.NHibernate.Audit; + +public interface IAuditRevisionUserAuthenticationService +{ + string GetUserName(); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/ModifyAuditEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/ModifyAuditEventListener.cs index 422992459..570819277 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/ModifyAuditEventListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/ModifyAuditEventListener.cs @@ -2,7 +2,6 @@ using System.Threading; using System.Threading.Tasks; -using Framework.Core.Services; using Framework.DomainDriven.Audit; using NHibernate.Event; @@ -15,11 +14,8 @@ public class ModifyAuditEventListener : AuditEventListenerBase, IPreInsertEventL public ModifyAuditEventListener(IEnumerable auditProperties) : base(auditProperties) { - } - public static ModifyAuditEventListener Create(IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) => new ModifyAuditEventListener(AuditPropertyPair.GetCreateAuditProperty(userAuthenticationService, dateTimeService)); - public Task OnPreInsertAsync(PreInsertEvent @event, CancellationToken cancellationToken) { return Task.FromResult(this.OnPreInsert(@event)); diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/RevisionEntityListener.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/RevisionEntityListener.cs index 53a693683..c2044b102 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/RevisionEntityListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Audit/RevisionEntityListener.cs @@ -2,6 +2,8 @@ using Framework.Core.Services; +using JetBrains.Annotations; + using NHibernate.Envers; namespace Framework.DomainDriven.NHibernate.Audit @@ -12,14 +14,12 @@ namespace Framework.DomainDriven.NHibernate.Audit /// public abstract class RevisionEntityListener : IEntityTrackingRevisionListener { - private readonly IUserAuthenticationService userAuthenticationService; - - protected RevisionEntityListener(IUserAuthenticationService userAuthenticationService) + protected RevisionEntityListener([NotNull] IAuditRevisionUserAuthenticationService auditRevisionUserAuthenticationService) { - this.userAuthenticationService = userAuthenticationService; + this.AuditRevisionUserAuthenticationService = auditRevisionUserAuthenticationService ?? throw new ArgumentNullException(nameof(auditRevisionUserAuthenticationService)); } - protected IUserAuthenticationService UserAuthenticationService => this.userAuthenticationService; + protected IAuditRevisionUserAuthenticationService AuditRevisionUserAuthenticationService {get; } public void NewRevision(object revisionEntity) { diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/AuditedExtension.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/AuditedExtension.cs index fac0bc5fd..dc415ed13 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/AuditedExtension.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/AuditedExtension.cs @@ -19,7 +19,7 @@ namespace Framework.DomainDriven.NHibernate { public static class AuditedExtension { - public static void InitializeAudit([NotNull] this Configuration configuration, [NotNull] IEnumerable preMappingSettings, [NotNull] IUserAuthenticationService userAuthenticationService) + public static void InitializeAudit([NotNull] this Configuration configuration, [NotNull] IEnumerable preMappingSettings, [NotNull] IAuditRevisionUserAuthenticationService auditRevisionUserAuthenticationService) { if (configuration == null) { @@ -31,9 +31,9 @@ public static void InitializeAudit([NotNull] this Configuration configuration, [ throw new ArgumentNullException(nameof(preMappingSettings)); } - if (userAuthenticationService == null) + if (auditRevisionUserAuthenticationService == null) { - throw new ArgumentNullException(nameof(userAuthenticationService)); + throw new ArgumentNullException(nameof(auditRevisionUserAuthenticationService)); } var mappingSettings = preMappingSettings.Where(z => z.IsAudited()).ToArray(); @@ -55,21 +55,21 @@ public static void InitializeAudit([NotNull] this Configuration configuration, [ var auditedAssemblies = mappingSettings.GroupBy(z => z.PersistentDomainObjectBaseType); - var provider = GetProvider(auditedAssemblies, tablePostfix, userAuthenticationService); + var provider = GetProvider(auditedAssemblies, tablePostfix, auditRevisionUserAuthenticationService); - configuration.IntegrateWithEnvers(new AuditEventListenterForke(), provider); + configuration.IntegrateWithEnvers(new AuditEventListenerForke(), provider); } private static IMetaDataProvider GetProvider( IEnumerable> auditedAssemblies, string tablePostfix, - IUserAuthenticationService userAuthenticationService) + IAuditRevisionUserAuthenticationService auditRevisionUserAuthenticationService) { var assemblies = auditedAssemblies.SelectMany(z => z).ToArray(); var auditesSchemas = assemblies.Select(z => z.AuditDatabase.RevisionEntitySchema).Distinct().SingleOrDefault(() => new ArgumentException("More then one AuditDatabase. There can be only one!")); - return new AuditMetadataProvider(assemblies, auditesSchemas, tablePostfix, new AuditRevisionEntityListener(userAuthenticationService)); + return new AuditMetadataProvider(assemblies, auditesSchemas, tablePostfix, new AuditRevisionEntityListener(auditRevisionUserAuthenticationService)); } } } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/AvailableValuesHelper.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/AvailableValuesHelper.cs index b68525dde..92cc52b5a 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/AvailableValuesHelper.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/AvailableValuesHelper.cs @@ -5,7 +5,7 @@ namespace Framework.DomainDriven.NHibernate { - internal static class AvailableValuesHelper + public static class AvailableValuesHelper { private static readonly decimal DecimalLimit = (decimal)Math.Pow(10, 15) - 1M; @@ -14,4 +14,4 @@ internal static class AvailableValuesHelper new Range(SqlDateTime.MinValue.Value, SqlDateTime.MaxValue.Value), byte.MaxValue); } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/AuditReaderFactoryPatched.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/AuditReaderFactoryPatched.cs index 32baa8460..cc833cb5e 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/AuditReaderFactoryPatched.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/AuditReaderFactoryPatched.cs @@ -1,4 +1,7 @@ using System.Linq; + +using Framework.Core; + using NHibernate.Engine; using NHibernate.Envers.Event; @@ -20,7 +23,7 @@ public static IAuditReaderPatched GetAuditReader(this ISession session) return new AuditReaderPatched(auditEventListener.VerCfg, session, sessionImpl); } - return EmptyAuditReaderPatched.Value; + return LazyInterfaceImplementHelper.CreateNotImplemented(); } } } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/EmptyAuditReaderPatched.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/EmptyAuditReaderPatched.cs deleted file mode 100644 index 7ac6e5856..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/EmptyAuditReaderPatched.cs +++ /dev/null @@ -1,145 +0,0 @@ -using System; -using System.Collections.Generic; -using NHibernate.Envers.Query; -using NHibernate.Envers.Query.Criteria; - -namespace NHibernate.Envers.Patch -{ - public class EmptyAuditReaderPatched : IAuditReaderPatched - { - public static readonly EmptyAuditReaderPatched Value = new EmptyAuditReaderPatched(); - - public bool IsEmpty => true; - - public T Find(object primaryKey, long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public object Find(System.Type cls, object primaryKey, long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public object Find(string entityName, object primaryKey, long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public object Find(string entityName, object primaryKey, long revision, bool includeDeletions) - { - throw new NotImplementedException(); - } - - public IEnumerable GetRevisions(System.Type cls, object primaryKey) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IEnumerable GetRevisions(string entityName, object primaryKey) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public DateTime GetRevisionDate(long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public long GetRevisionNumberForDate(DateTime date) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public T FindRevision(long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public object FindRevision(long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IDictionary FindRevisions(IEnumerable revisions) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IDictionary FindRevisions(IEnumerable revisions) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public T GetCurrentRevision(bool persist) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public object GetCurrentRevision(bool persist) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public AuditQueryCreator CreateQuery() - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public ICrossTypeRevisionChangesReader CrossTypeRevisionChangesReader() - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public string GetEntityName(object primaryKey, long revision, object entity) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public bool IsEntityClassAudited(System.Type entityClass) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public bool IsEntityNameAudited(string entityName) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IEnumerable GetIdentiesBy(IAuditCriterion criterion) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IList FindObjects(IEnumerable primaryKeys, long revision) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IEnumerable GetRevisions(System.Type cls, object primaryKey, long maxRevisions) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public IList> GetDomainObjectRevisions(object primaryKey, int takeCount) - where T : class - { - throw new NotImplementedException(); - } - - public long? GetPreviusRevision(System.Type cls, object primaryKey, long maxRevisions) - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public AuditQueryCreatorPatched CreatePatchedQuery() - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - - public long GetMaxRevision() - { - throw new NotImplementedException(typeof(IAuditReaderPatched).Name + " is not initialized"); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/Forke/AuditEventListenterForke.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/Forke/AuditEventListenterForke.cs index f11f33550..7ba5b7139 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/Forke/AuditEventListenterForke.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/Forke/AuditEventListenterForke.cs @@ -16,9 +16,9 @@ namespace NHibernate.Envers.Patch.Forke { //TODO: fork only for fork AddModUnit. #IADFRAME-1676 // https://nhibernate.jira.com/projects/NHE/issues/NHE-166 - public class AuditEventListenterForke : AuditEventListener + public class AuditEventListenerForke : AuditEventListener { - public AuditEventListenterForke() + public AuditEventListenerForke() { } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/IAuditReaderPatched.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/IAuditReaderPatched.cs index 0d09e6056..3aa330cb7 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/IAuditReaderPatched.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Envers/IAuditReaderPatched.cs @@ -1,13 +1,12 @@ using System; using System.Collections.Generic; + using NHibernate.Envers.Query.Criteria; namespace NHibernate.Envers.Patch { public interface IAuditReaderPatched : IAuditReader { - bool IsEmpty { get; } - IEnumerable GetIdentiesBy(IAuditCriterion criterion); IList FindObjects(IEnumerable primaryKeys, long revision); diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Framework.DomainDriven.NHibernate.csproj b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Framework.DomainDriven.NHibernate.csproj index dd85fc07d..d8408cd83 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/Framework.DomainDriven.NHibernate.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/Framework.DomainDriven.NHibernate.csproj @@ -4,8 +4,8 @@ - - + + diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/INHibSessionEnvironmentSettings.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/INHibSessionEnvironmentSettings.cs new file mode 100644 index 000000000..d498c5139 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/INHibSessionEnvironmentSettings.cs @@ -0,0 +1,8 @@ +using System; + +namespace Framework.DomainDriven.NHibernate; + +public interface INHibSessionEnvironmentSettings +{ + TimeSpan TransactionTimeout { get; } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDal.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDal.cs index f2e7f28ce..a0bce163d 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDal.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDal.cs @@ -24,9 +24,9 @@ internal class NHibDal : IDAL { private static readonly LambdaCompileCache LambdaCompileCache = new LambdaCompileCache(); - private readonly NHibSession session; + private readonly NHibSessionBase session; - public NHibDal(NHibSession session) => this.session = session ?? throw new ArgumentNullException(nameof(session)); + public NHibDal(NHibSessionBase session) => this.session = session ?? throw new ArgumentNullException(nameof(session)); private ISession InnerSession => this.session.InnerSession; @@ -45,7 +45,7 @@ public virtual void Save(TDomainObject domainObject) this.InnerSession.SaveOrUpdate(domainObject); - this.session.RegisterModifited(domainObject, ModificationType.Save); + this.session.RegisterModified(domainObject, ModificationType.Save); } public virtual void Insert(TDomainObject domainObject, TIdent id) @@ -59,14 +59,14 @@ public virtual void Insert(TDomainObject domainObject, TIdent id) this.InnerSession.Save(domainObject, id); - this.session.RegisterModifited(domainObject, ModificationType.Save); + this.session.RegisterModified(domainObject, ModificationType.Save); } public virtual void Remove(TDomainObject domainObject) { this.CheckWrite(); - this.session.RegisterModifited(domainObject, ModificationType.Remove); + this.session.RegisterModified(domainObject, ModificationType.Remove); this.InnerSession.Delete(domainObject); diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDalFactory.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDalFactory.cs index a284626da..302833264 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDalFactory.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibDalFactory.cs @@ -8,16 +8,14 @@ namespace Framework.DomainDriven.NHibernate internal class NHibDalFactory : IDALFactory where TPersistentDomainObjectBase : class, IIdentityObject { - private readonly NHibSession _session; + private readonly NHibSessionBase session; - public NHibDalFactory(NHibSession session) + public NHibDalFactory(NHibSessionBase session) { - if (session == null) throw new ArgumentNullException(nameof(session)); + this.session = session ?? throw new ArgumentNullException(nameof(session)); - this._session = session; - - if (!this._session.SessionFactory.RegisteredTypes.Contains(typeof(TPersistentDomainObjectBase))) + if (!this.session.Environment.RegisteredTypes.Contains(typeof(TPersistentDomainObjectBase))) { throw new Exception($"Mapping Settings for type {typeof(TPersistentDomainObjectBase).FullName} not found"); } @@ -27,7 +25,7 @@ public NHibDalFactory(NHibSession session) public IDAL CreateDAL() where TDomainObject : class, TPersistentDomainObjectBase { - return new NHibDal(this._session); + return new NHibDal(this.session); } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibObjectStatesService.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibObjectStatesService.cs index ec4308383..bf0c7ec79 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibObjectStatesService.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibObjectStatesService.cs @@ -16,14 +16,12 @@ namespace Framework.DomainDriven.NHibernate { internal class NHibObjectStatesService : IObjectStateService { - private readonly ISession _session; + private readonly ISession session; public NHibObjectStatesService([NotNull] ISession session) { - if (session == null) throw new ArgumentNullException(nameof(session)); - - this._session = session; + this.session = session ?? throw new ArgumentNullException(nameof(session)); } @@ -34,23 +32,23 @@ public IEnumerable GetModifiedObjectStates(object entity) return new ObjectState[0]; } - if (this._session.DefaultReadOnly) + if (this.session.DefaultReadOnly) { return new ObjectState[0]; } - var sessionImpl = this._session.GetSessionImplementation(); + var sessionImpl = this.session.GetSessionImplementation(); var unProxy = sessionImpl.TryUnProxy(entity); - var oldEntry = this._session.GetEntityEntry(unProxy); + var oldEntry = this.session.GetEntityEntry(unProxy); if (null == oldEntry) { return new ObjectState[0]; } - var persister = this._session.GetPersister(oldEntry); + var persister = this.session.GetPersister(oldEntry); var oldState = oldEntry.LoadedState; @@ -107,7 +105,7 @@ public IEnumerable GetModifiedObjectStates(object entity) } return currentCollection - .SelectMany(z => this._session.GetEntityEntry(z) != null ? this.GetModifiedObjectStates(z) : new[] { new ObjectState(), }) + .SelectMany(z => this.session.GetEntityEntry(z) != null ? this.GetModifiedObjectStates(z) : new[] { new ObjectState(), }) .Any(); } @@ -139,7 +137,7 @@ public bool IsNew([NotNull] object entity) { if (entity == null) throw new ArgumentNullException(nameof(entity)); - var oldEntry = this._session.GetEntityEntry(entity); + var oldEntry = this.session.GetEntityEntry(entity); if (null == oldEntry) { @@ -153,7 +151,7 @@ public bool IsRemoving([NotNull] object entity) { if (entity == null) throw new ArgumentNullException(nameof(entity)); - var entityEntry = this._session.GetEntityEntry(entity); + var entityEntry = this.session.GetEntityEntry(entity); return entityEntry.Status == Status.Deleted; } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionEnvironment.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionEnvironment.cs new file mode 100644 index 000000000..d0a788359 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionEnvironment.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; + +using Framework.Core; +using Framework.DomainDriven.NHibernate.Audit; +using Framework.DomainDriven.NHibernate.SqlExceptionProcessors; +using Framework.Exceptions; + +using JetBrains.Annotations; + +using NHibernate; +using NHibernate.Cfg; +using NHibernate.Dialect; +using NHibernate.Envers.Configuration; +using NHibernate.Tool.hbm2ddl; + +namespace Framework.DomainDriven.NHibernate +{ + public class NHibSessionEnvironment : IDisposable + { + private readonly Configuration cfg; + + /// + /// Creates new NH Session Factory + /// + /// connection settings + /// mapping settings + /// + /// connectionSettings + /// or + /// mappingSettings + /// + /// All mapping settings has equal database with schema. Utilities, Workflow has domain object with same names + /// Could not initialize ServiceFactory. + public NHibSessionEnvironment( + [NotNull] NHibConnectionSettings connectionSettings, + [NotNull] IEnumerable mappingSettings, + IAuditRevisionUserAuthenticationService auditRevisionUserAuthenticationService, + INHibSessionEnvironmentSettings settings) + { + this.ConnectionSettings = connectionSettings ?? throw new ArgumentNullException(nameof(connectionSettings)); + + var cachedMappingSettings = (mappingSettings ?? throw new ArgumentNullException(nameof(mappingSettings))).ToList(); + + this.TransactionTimeout = settings.TransactionTimeout; + + if (cachedMappingSettings.SelectMany(z => new[] { z.Database, z.AuditDatabase }).Where(z => null != z).Distinct().Count() == 1) + { + throw new System.ArgumentException("All mapping settings has equal database with schema. Utilities has domain object with same names"); + } + + try + { + this.cfg = new Configuration(); + + this.RegisteredTypes = cachedMappingSettings.ToHashSet(ms => ms.PersistentDomainObjectBaseType); + + foreach (var ms in cachedMappingSettings) + { + ms.InitMapping(this.cfg); + } + + this.cfg.InitializeAudit(cachedMappingSettings, auditRevisionUserAuthenticationService); + + connectionSettings.Init(this.cfg); + + SchemaMetadataUpdater.QuoteTableAndColumns(this.cfg, Dialect.GetDialect(this.cfg.Properties)); + + this.InternalSessionFactory = this.cfg.BuildSessionFactory(); + + this.ExceptionProcessor = new SqlExceptionProcessorInterceptor(this.InternalSessionFactory, this.cfg); + } + catch (Exception ex) + { + throw new ApplicationException("Could not initialize ServiceFactory.", ex); + } + } + + [NotNull] + public NHibConnectionSettings ConnectionSettings { get; } + + internal TimeSpan TransactionTimeout { get; } + + internal ISessionFactory InternalSessionFactory { get; } + + internal HashSet RegisteredTypes { get; } + + internal IExceptionProcessor ExceptionProcessor { get; } + + public Configuration Configuration => this.cfg; + + /// + /// Process transaction created in Write session + /// + public virtual void ProcessTransaction(IDbTransaction dbTransaction) + { + // Do nothing + } + + /// + /// Backward compatibility for TransactionScope + /// + public bool EnableTransactionScope { get; set; } = true; + + /// + public void Dispose() + { + AuditConfiguration.Remove(this.cfg); + this.InternalSessionFactory.Close(); + } + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionEnvironmentSettings.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionEnvironmentSettings.cs new file mode 100644 index 000000000..1612ba2e1 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionEnvironmentSettings.cs @@ -0,0 +1,8 @@ +using System; + +namespace Framework.DomainDriven.NHibernate; + +public class NHibSessionEnvironmentSettings : INHibSessionEnvironmentSettings +{ + public TimeSpan TransactionTimeout { get; } = new TimeSpan(0, 20, 0); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionFactory.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionFactory.cs deleted file mode 100644 index c6b2b731d..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NHibSessionFactory.cs +++ /dev/null @@ -1,245 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; - -using Framework.Core; -using Framework.Core.Services; -using Framework.DomainDriven.Audit; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.NHibernate.Audit; -using Framework.DomainDriven.NHibernate.SqlExceptionProcessors; -using Framework.Exceptions; - -using JetBrains.Annotations; - -using NHibernate; -using NHibernate.Cfg; -using NHibernate.Dialect; -using NHibernate.Envers.Configuration; -using NHibernate.Event; -using NHibernate.Tool.hbm2ddl; - -namespace Framework.DomainDriven.NHibernate -{ - public class NHibSessionFactory : IDBSessionFactory - { - private static readonly TimeSpan DefaultTransactionTimeout = new TimeSpan(0, 20, 0); - - private readonly Configuration cfg; - - /// Creates new NH Session Factory - /// - /// conntection settings - /// mapping settings - public NHibSessionFactory([NotNull] NHibConnectionSettings connectionSettings, [NotNull] IEnumerable mappingSettings, IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) - : this(connectionSettings, mappingSettings, DefaultTransactionTimeout, userAuthenticationService, dateTimeService) - { - } - - /// Creates new NH Session Factory - /// - /// connectino settings - /// mapping settings - /// transaction timeout - public NHibSessionFactory([NotNull] NHibConnectionSettings connectionSettings, [NotNull] IEnumerable mappingSettings, TimeSpan transactionTimeout, IUserAuthenticationService userAuthenticationService, IDateTimeService dateTimeService) - : this(connectionSettings, mappingSettings, transactionTimeout, AvailableValuesHelper.AvailableValues, AuditPropertyPair.GetModifyAuditProperty(userAuthenticationService, dateTimeService), AuditPropertyPair.GetCreateAuditProperty(userAuthenticationService, dateTimeService), userAuthenticationService) - { - } - - /// - /// Creates new NH Session Factory - /// - /// connectino settings - /// mapping settings - /// transaction timeout - /// different data types' value limits. Goes to - /// modify audit properties - /// create audit properties - /// The user authentication service. - /// - /// connectionSettings - /// or - /// mappingSettings - /// or - /// availableValues - /// or - /// modifyAuditProperties - /// or - /// createAuditProperties - /// - /// All mapping settings has equal database with schema. Utilities, Worflow has domain object with same names - /// Could not initialize ServiceFactory. - public NHibSessionFactory( - [NotNull] NHibConnectionSettings connectionSettings, - [NotNull] IEnumerable mappingSettings, - TimeSpan transactionTimeout, - [NotNull] AvailableValues availableValues, - [NotNull] IEnumerable modifyAuditProperties, - [NotNull] IEnumerable createAuditProperties, - [NotNull] IUserAuthenticationService userAuthenticationService) - { - if (connectionSettings == null) - { - throw new ArgumentNullException(nameof(connectionSettings)); - } - - if (mappingSettings == null) - { - throw new ArgumentNullException(nameof(mappingSettings)); - } - - if (availableValues == null) - { - throw new ArgumentNullException(nameof(availableValues)); - } - - if (modifyAuditProperties == null) - { - throw new ArgumentNullException(nameof(modifyAuditProperties)); - } - - if (createAuditProperties == null) - { - throw new ArgumentNullException(nameof(createAuditProperties)); - } - - this.AvailableValues = availableValues; - this.TransactionTimeout = transactionTimeout; - - var cachedMappingSettings = mappingSettings.ToList(); - - if (cachedMappingSettings.SelectMany(z => new[] { z.Database, z.AuditDatabase }).Where(z => null != z).Distinct().Count() == 1) - { - throw new System.ArgumentException("All mapping settings has equal database with schema. Utilities, Worflow has domain object with same names"); - } - - try - { - this.cfg = new Configuration(); - - this.RegisteredTypes = cachedMappingSettings.ToHashSet(ms => ms.PersistentDomainObjectBaseType); - - foreach (var ms in cachedMappingSettings) - { - ms.InitMapping(this.cfg); - } - - this.cfg.InitializeAudit(cachedMappingSettings, userAuthenticationService); - -#pragma warning disable 0618 // Obsolete - if (connectionSettings.UseEventListenerInsteadOfInterceptorForAudit) - { - var modifyAuditEventListener = new ModifyAuditEventListener(modifyAuditProperties); - var createAuditEventListener = new CreateAuditEventListener(createAuditProperties); -#pragma warning restore 0618 - - this.cfg.EventListeners.PreUpdateEventListeners = new IPreUpdateEventListener[] { modifyAuditEventListener }; - this.cfg.EventListeners.PreInsertEventListeners = new IPreInsertEventListener[] { modifyAuditEventListener, createAuditEventListener }; - } - else - { - this.cfg.SetInterceptor(new AuditInterceptor(createAuditProperties, modifyAuditProperties)); - } - - connectionSettings.Init(this.cfg); - - SchemaMetadataUpdater.QuoteTableAndColumns(this.cfg, Dialect.GetDialect(this.cfg.Properties)); - - this.InternalSessionFactory = this.cfg.BuildSessionFactory(); - - this.ExceptionProcessor = new SqlExceptionProcessorInterceptor(this.InternalSessionFactory, this.cfg); - } - catch (Exception ex) - { - throw new ApplicationException("Could not initialize ServiceFactory.", ex); - } - } - - /// Different data types' value limits - /// - public AvailableValues AvailableValues { get; } - - internal TimeSpan TransactionTimeout { get; } - - internal ISessionFactory InternalSessionFactory { get; } - - internal HashSet RegisteredTypes { get; } - - internal IExceptionProcessor ExceptionProcessor { get; } - - public Configuration Configuration => this.cfg; - - /// - /// Process transaction created in Write session - /// - public virtual void ProcessTransaction(IDbTransaction dbTransaction) - { - // Do nothing - } - - /// - /// Backward compatibility for TransactionScope - /// - public bool EnableTransactionScope - { - get; - set; - } = true; - - protected internal void OnSessionFlushed([NotNull] SessionFlushedEventArgs e) - { - if (e == null) throw new ArgumentNullException(nameof(e)); - - this.SessionFlushed.Maybe(handler => handler(this, e)); - } - - protected internal virtual void OnSessionAfterTransactionCompleted([NotNull] SessionFlushedEventArgs e) - { - if (e == null) { throw new ArgumentNullException(nameof(e)); } - - this.SessionAfterTransactionCompleted?.Invoke(this, e); - } - - protected internal virtual void OnSessionBeforeTransactionCompleted([NotNull] SessionFlushedEventArgs e) - { - if (e == null) { throw new ArgumentNullException(nameof(e)); } - - this.SessionBeforeTransactionCompleted?.Invoke(this, e); - } - - /// Creates DB session - /// - /// session's mode - /// New DB session - public IDBSession Create(DBSessionMode openMode) - { - if (DBSessionMode.Read == openMode) - { - return new ReadOnlyNHibSession(this); - } - - return new WriteNHibSession(this); - } - - /// Session flushed event - /// - public event EventHandler SessionFlushed; - - /// Transaction completed event - /// - [Obsolete("Use SessionAfterTransactionCompleted", true)] - public event EventHandler SessionTransactionCompleted; - - public event EventHandler SessionBeforeTransactionCompleted; - - public event EventHandler SessionAfterTransactionCompleted; - - /// - public void Dispose() - { - AuditConfiguration.Remove(this.cfg); - this.InternalSessionFactory.Close(); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/EventListenersExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/EventListenersExtensions.cs new file mode 100644 index 000000000..56801b6b6 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/EventListenersExtensions.cs @@ -0,0 +1,56 @@ +using System; +using System.Linq; + +using Framework.Core; + +using JetBrains.Annotations; + +using NHibernate.Event; + +namespace Framework.DomainDriven.NHibernate; + +public static class EventListenersExtensions +{ + internal static EventListeners Clone([NotNull] this EventListeners eventListeners) + { + if (eventListeners == null) throw new ArgumentNullException(nameof(eventListeners)); + + return new EventListeners + { + PostDeleteEventListeners = eventListeners.PostDeleteEventListeners, + PostUpdateEventListeners = eventListeners.PostUpdateEventListeners, + PostInsertEventListeners = eventListeners.PostInsertEventListeners, + PostCollectionRecreateEventListeners = eventListeners.PostCollectionRecreateEventListeners, + PreCollectionRemoveEventListeners = eventListeners.PreCollectionRemoveEventListeners, + PreCollectionUpdateEventListeners = eventListeners.PreCollectionUpdateEventListeners, + LoadEventListeners = eventListeners.LoadEventListeners, + SaveOrUpdateEventListeners = eventListeners.SaveOrUpdateEventListeners, + MergeEventListeners = eventListeners.MergeEventListeners, + PersistEventListeners = eventListeners.PersistEventListeners, + PersistOnFlushEventListeners = eventListeners.PersistOnFlushEventListeners, + ReplicateEventListeners = eventListeners.ReplicateEventListeners, + DeleteEventListeners = eventListeners.DeleteEventListeners, + AutoFlushEventListeners = eventListeners.AutoFlushEventListeners, + DirtyCheckEventListeners = eventListeners.DirtyCheckEventListeners, + FlushEventListeners = eventListeners.FlushEventListeners, + EvictEventListeners = eventListeners.EvictEventListeners, + LockEventListeners = eventListeners.LockEventListeners, + RefreshEventListeners = eventListeners.RefreshEventListeners, + PostCommitUpdateEventListeners = eventListeners.PostCommitUpdateEventListeners, + PostCommitInsertEventListeners = eventListeners.PostCommitInsertEventListeners, + PreCollectionRecreateEventListeners = eventListeners.PreCollectionRecreateEventListeners, + PostCollectionRemoveEventListeners = eventListeners.PostCollectionRemoveEventListeners, + PostCollectionUpdateEventListeners = eventListeners.PostCollectionUpdateEventListeners, + SaveEventListeners = eventListeners.SaveEventListeners, + UpdateEventListeners = eventListeners.UpdateEventListeners, + PreUpdateEventListeners = eventListeners.PreUpdateEventListeners, + PreInsertEventListeners = eventListeners.PreInsertEventListeners, + PostCommitDeleteEventListeners = eventListeners.PostCommitDeleteEventListeners, + InitializeCollectionEventListeners = eventListeners.InitializeCollectionEventListeners, + PostLoadEventListeners = eventListeners.PostLoadEventListeners, + PreLoadEventListeners = eventListeners.PreLoadEventListeners, + PreDeleteEventListeners = eventListeners.PreDeleteEventListeners, + FlushEntityEventListeners = eventListeners.FlushEntityEventListeners + }; + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/INHibSessionSettings.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/INHibSessionSettings.cs new file mode 100644 index 000000000..6fe6a1e59 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/INHibSessionSettings.cs @@ -0,0 +1,13 @@ +using Framework.DomainDriven.Audit; +using Framework.DomainDriven.BLL; + +namespace Framework.DomainDriven.NHibernate; + +public interface INHibSessionSetup +{ + DBSessionMode DefaultSessionMode { get; } + + AuditPropertyPair GetCreateAuditProperty(); + + AuditPropertyPair GetModifyAuditProperty(); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSession.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSession.cs index 1bb9e5d82..901aae609 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSession.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSession.cs @@ -1,136 +1,105 @@ using System; using System.Collections.Generic; -using Framework.Core; using Framework.DomainDriven.BLL; using Framework.DomainDriven.BLL.Tracking; -using Framework.DomainDriven.DAL.Revisions; using Framework.Persistent; using JetBrains.Annotations; -using NHibernate; -using NHibernate.Envers.Patch; +namespace Framework.DomainDriven.NHibernate; -namespace Framework.DomainDriven.NHibernate +public class NHibSession : IDBSession { - public abstract class NHibSession : IDBSession - { - private Lazy lazyAuditReader { get; } - - internal NHibSession(NHibSessionFactory sessionFactory, DBSessionMode sessionMode) - { - this.SessionFactory = sessionFactory ?? throw new ArgumentNullException(nameof(sessionFactory)); - this.SessionMode = sessionMode; - - this.lazyAuditReader = LazyHelper.Create(() => this.InnerSession.GetAuditReader()); - } - - public IAuditReaderPatched AuditReader => this.lazyAuditReader.Value; - - public ISession InnerSession { get; protected set; } + private DBSessionMode? sessionMode; - protected internal NHibSessionFactory SessionFactory { get; protected set; } + private readonly Lazy lazyInnerSession; - protected internal DBSessionMode SessionMode { get; } - - protected bool HasFlushedListeners => this.Flushed != null; - - public abstract void RegisterModifited(TDomainObject domainObject, ModificationType modificationType); - - /// - public abstract void Flush(); - - /// - public long GetCurrentRevision() - { - return this.AuditReader.GetCurrentRevision(false).Id; - } + public NHibSession([NotNull] NHibSessionEnvironment environment, INHibSessionSetup settings, IDBSessionEventListener eventListener) + { + if (environment == null) throw new ArgumentNullException(nameof(environment)); - /// - public long GetMaxRevision() + this.lazyInnerSession = new Lazy(() => { - return this.AuditReader.GetMaxRevision(); - } - - public abstract IEnumerable GetModifiedObjectsFromLogic(); - - public abstract IEnumerable GetModifiedObjectsFromLogic(); + switch (this.sessionMode ?? settings.DefaultSessionMode) + { + case DBSessionMode.Read: + return new ReadOnlyNHibSession(environment); + + case DBSessionMode.Write: + return new WriteNHibSession(environment, settings, eventListener); + + default: + throw new InvalidOperationException(); + } + }); + } - public abstract void ManualFault(); + public IDBSession InnerSession => this.lazyInnerSession.Value; - public abstract TResult Evaluate(Func getResult); + public DBSessionMode SessionMode => this.InnerSession.SessionMode; - public IObjectStateService GetObjectStateService() - { - return new NHibObjectStatesService(this.InnerSession); - } + public IObjectStateService GetObjectStateService() + { + return this.InnerSession.GetObjectStateService(); + } - public IDALFactory GetDALFactory() + public IDALFactory GetDALFactory() where TPersistentDomainObjectBase : class, IIdentityObject - { - return new NHibDalFactory(this); - } + { + return this.InnerSession.GetDALFactory(); + } - protected virtual void OnClosed([NotNull] EventArgs e) - { - if (e == null) throw new ArgumentNullException(nameof(e)); + public void Flush() + { + this.InnerSession.Flush(); + } - this.Closed?.Invoke(this, e); - } + public long GetCurrentRevision() => this.InnerSession.GetCurrentRevision(); - protected virtual void OnFlushed([NotNull] DALChangesEventArgs e) - { - if (e == null) throw new ArgumentNullException(nameof(e)); + public IEnumerable GetModifiedObjectsFromLogic() => this.InnerSession.GetModifiedObjectsFromLogic(); - this.Flushed?.Invoke(this, e); + public IEnumerable GetModifiedObjectsFromLogic() => this.InnerSession.GetModifiedObjectsFromLogic(); - this.SessionFactory.OnSessionFlushed(new SessionFlushedEventArgs(e.Changes, this)); - } + public void AsFault() => this.InnerSession.AsFault(); - protected virtual void OnBeforeTransactionCompleted([NotNull] DALChangesEventArgs e) - { - if (e == null) throw new ArgumentNullException(nameof(e)); + public long GetMaxRevision() => this.InnerSession.GetMaxRevision(); - this.BeforeTransactionCompleted?.Invoke(this, e); + public void AsReadOnly() + { + this.ApplySessionMode(DBSessionMode.Read); + } - this.SessionFactory.OnSessionBeforeTransactionCompleted(new SessionFlushedEventArgs(e.Changes, this)); - } + public void AsWritable() + { + this.ApplySessionMode(DBSessionMode.Write); + } - protected virtual void OnAfterTransactionCompleted([NotNull] DALChangesEventArgs e) + private void ApplySessionMode(DBSessionMode applySessionMode) + { + if (!this.lazyInnerSession.IsValueCreated) { - if (e == null) throw new ArgumentNullException(nameof(e)); - - this.AfterTransactionCompleted?.Invoke(this, e); - - this.SessionFactory.OnSessionAfterTransactionCompleted(new SessionFlushedEventArgs(e.Changes, this)); + this.sessionMode = applySessionMode; } - - protected void ClearClosed() + else if (this.SessionMode != applySessionMode) { - this.Closed = null; + throw new InvalidOperationException("Session mode can't be changed after create session"); } + } - protected void ClearFlushed() + public void Close() + { + if (this.lazyInnerSession.IsValueCreated) { - this.Flushed = null; + this.InnerSession.Close(); } + } - protected void ClearTransactionCompleted() + public void Dispose() + { + if (this.lazyInnerSession.IsValueCreated) { - this.BeforeTransactionCompleted = null; - this.AfterTransactionCompleted = null; + this.InnerSession.Dispose(); } - - public event EventHandler Closed; - - public event EventHandler Flushed; - - [Obsolete("Since 6.0 Use AfterTransactionCompleted", true)] - public event EventHandler TransactionCompleted; - - public event EventHandler BeforeTransactionCompleted; - - public event EventHandler AfterTransactionCompleted; } } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSessionBase.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSessionBase.cs new file mode 100644 index 000000000..44ce2478b --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSessionBase.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; + +using Framework.Core; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.BLL.Tracking; +using Framework.DomainDriven.DAL.Revisions; +using Framework.Persistent; + +using NHibernate; +using NHibernate.Envers.Patch; + +namespace Framework.DomainDriven.NHibernate +{ + public abstract class NHibSessionBase : IDBSession + { + private Lazy lazyAuditReader { get; } + + internal NHibSessionBase(NHibSessionEnvironment environment, DBSessionMode sessionMode) + { + this.Environment = environment ?? throw new ArgumentNullException(nameof(environment)); + this.SessionMode = sessionMode; + + this.lazyAuditReader = LazyHelper.Create(() => this.InnerSession.GetAuditReader()); + } + + public abstract bool Closed { get; } + + public DBSessionMode SessionMode { get; } + + public IAuditReaderPatched AuditReader => this.lazyAuditReader.Value; + + public abstract ISession InnerSession { get; } + + protected internal NHibSessionEnvironment Environment { get; } + + public abstract void RegisterModified(TDomainObject domainObject, ModificationType modificationType); + + /// + public abstract void Flush(); + + /// + public long GetCurrentRevision() + { + return this.AuditReader.GetCurrentRevision(false).Id; + } + + /// + public long GetMaxRevision() + { + return this.AuditReader.GetMaxRevision(); + } + + public abstract IEnumerable GetModifiedObjectsFromLogic(); + + public abstract IEnumerable GetModifiedObjectsFromLogic(); + + public abstract void AsFault(); + + /// + public abstract void AsReadOnly(); + + /// + public abstract void AsWritable(); + + public IObjectStateService GetObjectStateService() + { + return new NHibObjectStatesService(this.InnerSession); + } + + public IDALFactory GetDALFactory() + where TPersistentDomainObjectBase : class, IIdentityObject + { + return new NHibDalFactory(this); + } + + public abstract void Close(); + + public void Dispose() + { + if (!this.Closed) + { + + } + + this.Close(); + } + } + + + + //public class NHibSession + //{ + // public NHibSession() + // { + + // } + + // private IDBSession Create(DBSessionMode openMode) + // { + // if (DBSessionMode.Read == openMode) + // { + // return new ReadOnlyNHibSession(this); + // } + + // return new WriteNHibSession(this); + // } + + // protected internal void OnSessionFlushed([NotNull] SessionFlushedEventArgs e) + // { + // if (e == null) throw new ArgumentNullException(nameof(e)); + + // this.SessionFlushed.Maybe(handler => handler(this, e)); + // } + + // protected internal virtual void OnSessionAfterTransactionCompleted([NotNull] SessionFlushedEventArgs e) + // { + // if (e == null) { throw new ArgumentNullException(nameof(e)); } + + // this.SessionAfterTransactionCompleted?.Invoke(this, e); + // } + + // protected internal virtual void OnSessionBeforeTransactionCompleted([NotNull] SessionFlushedEventArgs e) + // { + // if (e == null) { throw new ArgumentNullException(nameof(e)); } + + // this.SessionBeforeTransactionCompleted?.Invoke(this, e); + // } + + + // /// Session flushed event + // /// + // public event EventHandler SessionFlushed; + + // /// Transaction completed event + // /// + // [Obsolete("Use SessionAfterTransactionCompleted", true)] + // public event EventHandler SessionTransactionCompleted; + + // public event EventHandler SessionBeforeTransactionCompleted; + + // public event EventHandler SessionAfterTransactionCompleted; + //} +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSessionSettings.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSessionSettings.cs new file mode 100644 index 000000000..a3f7c3964 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NHibSessionSettings.cs @@ -0,0 +1,32 @@ +using System; + +using Framework.Core.Services; +using Framework.DomainDriven.Audit; +using Framework.DomainDriven.BLL; + +using JetBrains.Annotations; + +namespace Framework.DomainDriven.NHibernate; + +public class NHibSessionSettings : INHibSessionSetup +{ + [NotNull] + private readonly IUserAuthenticationService userAuthenticationService; + + [NotNull] + private readonly IDateTimeService dateTimeService; + + public NHibSessionSettings( + [NotNull] IUserAuthenticationService userAuthenticationService, + [NotNull] IDateTimeService dateTimeService) + { + this.userAuthenticationService = userAuthenticationService ?? throw new ArgumentNullException(nameof(userAuthenticationService)); + this.dateTimeService = dateTimeService ?? throw new ArgumentNullException(nameof(dateTimeService)); + } + + public DBSessionMode DefaultSessionMode { get; } = DBSessionMode.Write; + + public AuditPropertyPair GetCreateAuditProperty() => AuditPropertyPair.GetCreateAuditProperty(this.userAuthenticationService, this.dateTimeService); + + public AuditPropertyPair GetModifyAuditProperty() => AuditPropertyPair.GetModifyAuditProperty(this.userAuthenticationService, this.dateTimeService); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NhibSessionImplExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NhibSessionImplExtensions.cs index 92fbcf844..ca6a44960 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NhibSessionImplExtensions.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/NhibSessionImplExtensions.cs @@ -1,6 +1,9 @@ using System; using System.Reflection; +using Framework.Core; + +using NHibernate; using NHibernate.Event; using NHibernate.Impl; @@ -8,25 +11,25 @@ namespace Framework.DomainDriven.NHibernate { internal static class NhibSessionImplExtensions { - private const string ListenersFieldName = "listeners"; + private static readonly FieldInfo ListenersField = typeof(SessionImpl).GetField("listeners", BindingFlags.Instance | BindingFlags.NonPublic); - private static readonly FieldInfo ListenersField = typeof(SessionImpl).GetField(ListenersFieldName, BindingFlags.Instance | BindingFlags.NonPublic); + private static readonly Action SetInterceptorAction = ExpressionHelper.Create((SessionImpl s) => s.Interceptor).GetProperty().GetSetValueAction(); /// /// Специальный костыль для NHibernate по переопределению Listeners /// Применяется для работы с несколькими базами данных. - /// Обычное изменение Listeners не подходит, так как это повлечет изменение Listeners в SessionFactory + /// Обычное изменение Listeners не подходит, так как это повлечет изменение Listeners в SessionConfiguration /// /// /// internal static void OverrideListeners(this SessionImpl source, EventListeners listeners) { - if (ListenersField == null) - { - throw new ArgumentNullException($"{typeof(SessionImpl).Name} has no expected private field '{ListenersFieldName}'"); - } - ListenersField.SetValue(source, listeners); } + + internal static void OverrideInterceptor(this SessionImpl source, IInterceptor interceptor) + { + SetInterceptorAction(source, interceptor); + } } } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/ReadOnlyNHibSession.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/ReadOnlyNHibSession.cs index b6a5caf66..b8f97c9b2 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/ReadOnlyNHibSession.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/ReadOnlyNHibSession.cs @@ -1,20 +1,29 @@ -using System; +using System; using System.Collections.Generic; + using Framework.DomainDriven.BLL; using Framework.DomainDriven.DAL.Revisions; + using NHibernate; namespace Framework.DomainDriven.NHibernate { - internal class ReadOnlyNHibSession : NHibSession + internal class ReadOnlyNHibSession : NHibSessionBase { - internal ReadOnlyNHibSession(NHibSessionFactory sessionFactory) : base(sessionFactory, DBSessionMode.Read) - { - if (sessionFactory == null) throw new ArgumentNullException(nameof(sessionFactory)); + private bool closed; - this.SessionFactory = sessionFactory; + internal ReadOnlyNHibSession(NHibSessionEnvironment environment) + : base(environment, DBSessionMode.Read) + { + this.InnerSession = this.Environment.InternalSessionFactory.OpenSession(); + this.InnerSession.FlushMode = FlushMode.Manual; + this.InnerSession.DefaultReadOnly = true; } + public override bool Closed => this.closed; + + public sealed override ISession InnerSession { get; } + public override IEnumerable GetModifiedObjectsFromLogic() { yield break; @@ -25,41 +34,39 @@ public override IEnumerable GetModifiedObjectsFromLogic(Func getResult) + public override void Close() { - using (this.InnerSession = this.SessionFactory.InternalSessionFactory.OpenSession()) + if (this.closed) { - this.InnerSession.FlushMode = FlushMode.Never; - this.InnerSession.DefaultReadOnly = true; - - try - { - var result = getResult(this); + return; + } - this.OnClosed(EventArgs.Empty); + this.closed = true; - return result; - } - finally - { - this.ClearClosed(); - } - } + using (this.InnerSession) ; } public override void Flush() { - throw new NotImplementedException(); + throw new InvalidOperationException(); } - public override void RegisterModifited(T @object, ModificationType modificationType) + public override void RegisterModified(T @object, ModificationType modificationType) { - throw new ArgumentException($"Not supported: '{nameof(this.RegisterModifited)}' for {this.GetType()}"); + throw new ArgumentException($"Not supported: '{nameof(this.RegisterModified)}' for {this.GetType()}"); } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/WriteNHibSession.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/WriteNHibSession.cs index 862b66c26..c82ba5c00 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/WriteNHibSession.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/NhibSessions/WriteNHibSession.cs @@ -5,8 +5,12 @@ using System.Transactions; using Framework.Core; +using Framework.DomainDriven.Audit; using Framework.DomainDriven.BLL; using Framework.DomainDriven.DAL.Revisions; +using Framework.DomainDriven.NHibernate.Audit; + +using JetBrains.Annotations; using NHibernate; using NHibernate.Event; @@ -16,66 +20,94 @@ namespace Framework.DomainDriven.NHibernate { - public class WriteNHibSession : NHibSession + public class WriteNHibSession : NHibSessionBase { + private readonly IDBSessionEventListener eventListener; + + [NotNull] + private readonly AuditPropertyPair modifyAuditProperties; + + [NotNull] + private readonly AuditPropertyPair createAuditProperties; + private readonly ISet modifiedObjectsFromLogic = new HashSet(); private readonly CollectChangesEventListener collectChangedEventListener; + private readonly TransactionScope transactionScope; + + private readonly ITransaction transaction; + private bool manualFault; - internal WriteNHibSession(NHibSessionFactory sessionFactory) - : base(sessionFactory, DBSessionMode.Write) - { - this.SessionFactory = sessionFactory ?? throw new ArgumentNullException(nameof(sessionFactory)); + private bool closed; + internal WriteNHibSession(NHibSessionEnvironment environment, + INHibSessionSetup settings, + IDBSessionEventListener eventListener) + : base(environment, DBSessionMode.Write) + { + this.eventListener = eventListener; + this.modifyAuditProperties = settings.GetModifyAuditProperty(); + this.createAuditProperties = settings.GetCreateAuditProperty(); this.collectChangedEventListener = new CollectChangesEventListener(); + + this.transactionScope = this.Environment.EnableTransactionScope ? this.CreateTransactionScope() : null; + + this.InnerSession = this.Environment.InternalSessionFactory.OpenSession(); + this.InnerSession.FlushMode = FlushMode.Manual; + + this.transaction = this.InnerSession.BeginTransaction(); + + this.Environment.ProcessTransaction(GetDbTransaction(this.transaction, this.InnerSession)); + + this.ConfigureEventListeners(); + } + + public override bool Closed => this.closed; + + public sealed override ISession InnerSession { get; } + + private void ConfigureEventListeners() + { + var sessionImplementation = this.InnerSession.GetSessionImplementation(); + + var sessionImpl = (SessionImpl)sessionImplementation; + + sessionImpl.OverrideListeners(sessionImpl.Listeners.Clone().Self(this.InjectListeners)); + + sessionImpl.OverrideInterceptor(this.CreateInterceptor()); + } + + private void InjectListeners(EventListeners eventListeners) + { + eventListeners.PostDeleteEventListeners = eventListeners.PostDeleteEventListeners.Concat(new[] { this.collectChangedEventListener }).ToArray(); + eventListeners.PostUpdateEventListeners = eventListeners.PostUpdateEventListeners.Concat(new[] { this.collectChangedEventListener }).ToArray(); + eventListeners.PostInsertEventListeners = eventListeners.PostInsertEventListeners.Concat(new[] { this.collectChangedEventListener }).ToArray(); + + if (this.Environment.ConnectionSettings.UseEventListenerInsteadOfInterceptorForAudit) + { + var modifyAuditEventListener = new ModifyAuditEventListener(this.modifyAuditProperties); + var createAuditEventListener = new CreateAuditEventListener(this.createAuditProperties); +#pragma warning restore 0618 + + eventListeners.PreUpdateEventListeners = eventListeners.PreUpdateEventListeners.Concat(new IPreUpdateEventListener[] { modifyAuditEventListener }).ToArray(); + eventListeners.PreInsertEventListeners = eventListeners.PreInsertEventListeners.Concat(new IPreInsertEventListener[] { modifyAuditEventListener, createAuditEventListener }).ToArray(); + +#pragma warning disable 0618 // Obsolete + } } - private EventListeners GetOverrideEventListenersFrom(EventListeners source) + private IInterceptor CreateInterceptor() { - var result = new EventListeners(); - - result.PostDeleteEventListeners = - source.PostDeleteEventListeners.Concat(new[] { this.collectChangedEventListener }).ToArray(); - result.PostUpdateEventListeners = - source.PostUpdateEventListeners.Concat(new[] { this.collectChangedEventListener }).ToArray(); - result.PostInsertEventListeners = - source.PostInsertEventListeners.Concat(new[] { this.collectChangedEventListener }).ToArray(); - - result.LoadEventListeners = source.LoadEventListeners; - result.SaveOrUpdateEventListeners = source.SaveOrUpdateEventListeners; - result.MergeEventListeners = source.MergeEventListeners; - result.PersistEventListeners = source.PersistEventListeners; - result.PersistOnFlushEventListeners = source.PersistOnFlushEventListeners; - result.ReplicateEventListeners = source.ReplicateEventListeners; - result.DeleteEventListeners = source.DeleteEventListeners; - result.AutoFlushEventListeners = source.AutoFlushEventListeners; - result.DirtyCheckEventListeners = source.DirtyCheckEventListeners; - result.FlushEventListeners = source.FlushEventListeners; - result.EvictEventListeners = source.EvictEventListeners; - result.LockEventListeners = source.LockEventListeners; - result.RefreshEventListeners = source.RefreshEventListeners; - result.FlushEntityEventListeners = source.FlushEntityEventListeners; - result.InitializeCollectionEventListeners = source.InitializeCollectionEventListeners; - result.PostLoadEventListeners = source.PostLoadEventListeners; - result.PreLoadEventListeners = source.PreLoadEventListeners; - result.PreDeleteEventListeners = source.PreDeleteEventListeners; - result.PreUpdateEventListeners = source.PreUpdateEventListeners; - result.PreInsertEventListeners = source.PreInsertEventListeners; - result.PostCommitDeleteEventListeners = source.PostCommitDeleteEventListeners; - result.PostCommitUpdateEventListeners = source.PostCommitUpdateEventListeners; - result.PostCommitInsertEventListeners = source.PostCommitInsertEventListeners; - result.PreCollectionRecreateEventListeners = source.PreCollectionRecreateEventListeners; - result.PostCollectionRecreateEventListeners = source.PostCollectionRecreateEventListeners; - result.PreCollectionRemoveEventListeners = source.PreCollectionRemoveEventListeners; - result.PostCollectionRemoveEventListeners = source.PostCollectionRemoveEventListeners; - result.PreCollectionUpdateEventListeners = source.PreCollectionUpdateEventListeners; - result.PostCollectionUpdateEventListeners = source.PostCollectionUpdateEventListeners; - result.SaveEventListeners = source.SaveEventListeners; - result.UpdateEventListeners = source.UpdateEventListeners; - - return result; + if (this.Environment.ConnectionSettings.UseEventListenerInsteadOfInterceptorForAudit) + { + return new EmptyInterceptor(); + } + else + { + return new AuditInterceptor(this.createAuditProperties, this.modifyAuditProperties); + } } public override IEnumerable GetModifiedObjectsFromLogic() @@ -89,77 +121,52 @@ public override IEnumerable GetModifiedObjectsFromLogic typeof(TPersistentDomainObjectBase).IsAssignableFrom(obj.ObjectType)); } - public override void ManualFault() + public override void AsFault() { this.manualFault = true; } - public override TResult Evaluate(Func getResult) + public override void AsReadOnly() { - try - { - TResult result; - - if (this.SessionFactory.EnableTransactionScope) - { - using (var scope = this.CreateTransactionScope()) - { - result = this.EvaluateInternal(getResult); - - if (!this.manualFault) - { - scope.Complete(); - } - } - } - else - { - result = this.EvaluateInternal(getResult); - } + throw new InvalidOperationException("Writable session already created"); + } - return result; - } - finally - { - this.ClearClosed(); - this.ClearFlushed(); - this.ClearTransactionCompleted(); - } + public override void AsWritable() + { } - protected virtual TResult EvaluateInternal(Func getResult) + public override void Close() { - TResult result; - using (this.InnerSession = - this.SessionFactory.InternalSessionFactory.OpenSession().Self(z => z.FlushMode = FlushMode.Never)) + if (this.closed) { - using (var currentTransaction = this.InnerSession.BeginTransaction()) - { - this.SessionFactory.ProcessTransaction(GetDbTransaction(currentTransaction, this.InnerSession)); - - this.InnerSessionConfigure(); + return; + } - result = getResult(this); + this.closed = true; - if (this.manualFault) + using (this.transactionScope) + { + using (this.InnerSession) + { + using (this.transaction) { - if (!currentTransaction.WasRolledBack) + if (this.manualFault) { - currentTransaction.Rollback(); + if (!this.transaction.WasRolledBack) + { + this.transaction.Rollback(); + } } - } - else - { - this.Flush(true); + else + { + this.Flush(true); - currentTransaction.Commit(); + this.transaction.Commit(); + this.transactionScope?.Complete(); + } } - - this.OnClosed(EventArgs.Empty); } } - - return result; } private static IDbTransaction GetDbTransaction(ITransaction transaction, ISession session) @@ -172,21 +179,12 @@ private static IDbTransaction GetDbTransaction(ITransaction transaction, ISessio return dbCommand.Transaction; } - private void InnerSessionConfigure() - { - var sessionImplementation = this.InnerSession.GetSessionImplementation(); - - var sessionImpl = (SessionImpl)sessionImplementation; - - sessionImpl.OverrideListeners(this.GetOverrideEventListenersFrom(sessionImplementation.Listeners)); - } - private TransactionScope CreateTransactionScope() => new( TransactionScopeOption.Required, new TransactionOptions { - Timeout = this.SessionFactory.TransactionTimeout, + Timeout = this.Environment.TransactionTimeout, IsolationLevel = IsolationLevel.Serializable }); @@ -196,7 +194,7 @@ public override void Flush() this.Flush(false); } - private void Flush(bool withTransactionCompleted) + private void Flush(bool withCompleteTransaction) { try { @@ -220,15 +218,17 @@ private void Flush(bool withTransactionCompleted) var changedEventArgs = new DALChangesEventArgs(changes); - this.OnFlushed(changedEventArgs); + // WARNING: You can't invoke the listeners if ServiceProvider is in dispose state!!! Use UseTryCloseDbSession middleware + this.eventListener.OnFlushed(changedEventArgs); } - } while (this.HasFlushedListeners); + } while (true); - if (withTransactionCompleted) + if (withCompleteTransaction) { var beforeTransactionCompletedChangeState = dalHistory.Composite(); - this.OnBeforeTransactionCompleted(new DALChangesEventArgs(beforeTransactionCompletedChangeState)); + // WARNING: You can't invoke the listeners if ServiceProvider is in dispose state!!!!!! Use UseTryCloseDbSession middleware + this.eventListener.OnBeforeTransactionCompleted(new DALChangesEventArgs(beforeTransactionCompletedChangeState)); this.InnerSession.Flush(); @@ -236,7 +236,8 @@ private void Flush(bool withTransactionCompleted) new[] { beforeTransactionCompletedChangeState, this.collectChangedEventListener.EvictChanges() } .Composite(); - this.OnAfterTransactionCompleted(new DALChangesEventArgs(afterTransactionCompletedChangeState)); + // WARNING: You can't invoke the listeners if ServiceProvider is in dispose state!!!!!! Use UseTryCloseDbSession middleware + this.eventListener.OnAfterTransactionCompleted(new DALChangesEventArgs(afterTransactionCompletedChangeState)); this.InnerSession .Flush(); // Флашим для того, чтобы проверить, что никто ничего не менял в объектах после AfterTransactionCompleted-евента @@ -249,7 +250,7 @@ private void Flush(bool withTransactionCompleted) } catch (Exception e) { - var result = this.SessionFactory.ExceptionProcessor.Process(e); + var result = this.Environment.ExceptionProcessor.Process(e); if (result == e) { @@ -262,7 +263,7 @@ private void Flush(bool withTransactionCompleted) } } - public override void RegisterModifited(T @object, ModificationType modificationType) + public override void RegisterModified(T @object, ModificationType modificationType) { this.modifiedObjectsFromLogic.Add(new ObjectModification(@object, typeof(T), modificationType)); } diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/SqlExceptionProcessors/ArifmeticOverflowSqlProcessor.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/SqlExceptionProcessors/ArifmeticOverflowSqlProcessor.cs index 6618877d8..f49de56c0 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/SqlExceptionProcessors/ArifmeticOverflowSqlProcessor.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/SqlExceptionProcessors/ArifmeticOverflowSqlProcessor.cs @@ -6,7 +6,7 @@ internal class ArifmeticOverflowSqlProcessor : ISqlExceptionProcessor { public int ErrorNumber => 8115; - public Exception Process(HandledGenericADOException genericAdoException, ExceptionProcessingContext sessionFactory) + public Exception Process(HandledGenericADOException genericAdoException, ExceptionProcessingContext _) { var sqlException = genericAdoException.SqlException; return new ArifmeticOverflowDALException(sqlException.Message, sqlException.Message); diff --git a/src/_DomainDriven/Framework.DomainDriven.NHibernate/_MappingSettings/DefaultAuditTypeFilter.cs b/src/_DomainDriven/Framework.DomainDriven.NHibernate/_MappingSettings/DefaultAuditTypeFilter.cs index e6b1eb06d..7ca63ae1a 100644 --- a/src/_DomainDriven/Framework.DomainDriven.NHibernate/_MappingSettings/DefaultAuditTypeFilter.cs +++ b/src/_DomainDriven/Framework.DomainDriven.NHibernate/_MappingSettings/DefaultAuditTypeFilter.cs @@ -18,8 +18,8 @@ public DefaultAuditTypeFilter() { this._filters = new IAuditTypeFilter[] { - new AuditTypeFilterSerivce(), - new AuditTypeFilterSerivce(), + new AuditTypeFilterService(), + new AuditTypeFilterService(), new AuditPropertyFilterService(), new AuditPropertyFilterService(z=>z.Role == DetailRole.No), }; @@ -35,7 +35,7 @@ public bool IsAuditedProperty(Type type, PropertyInfo propertyInfo) return this._filters.All(z => z.IsAuditedProperty(type, propertyInfo)); } - private class AuditTypeFilterSerivce : IAuditTypeFilter + private class AuditTypeFilterService : IAuditTypeFilter where TAttribute : Attribute { public bool IsAuditedType(Type type) @@ -85,4 +85,4 @@ public bool IsAuditedProperty(Type type, PropertyInfo propertyInfo) } } } -} \ No newline at end of file +} diff --git a/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata.Tests.Unit/Framework.DomainDriven.SerializeMetadata.Tests.Unit.csproj b/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata.Tests.Unit/Framework.DomainDriven.SerializeMetadata.Tests.Unit.csproj index 072451f0c..9b1440b30 100644 --- a/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata.Tests.Unit/Framework.DomainDriven.SerializeMetadata.Tests.Unit.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata.Tests.Unit/Framework.DomainDriven.SerializeMetadata.Tests.Unit.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + diff --git a/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata/AnonimousTypeBuilder/ISystemMetadataTypeBuilderContainer.cs b/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata/AnonimousTypeBuilder/ISystemMetadataTypeBuilderContainer.cs deleted file mode 100644 index 047796080..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.SerializeMetadata/AnonimousTypeBuilder/ISystemMetadataTypeBuilderContainer.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Framework.DomainDriven.SerializeMetadata -{ - public interface ISystemMetadataTypeBuilderContainer - { - ISystemMetadataTypeBuilder SystemMetadataTypeBuilder { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/AuthorizationExternalSource/AuthorizationExternalSource.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/AuthorizationExternalSource/AuthorizationExternalSource.cs index 1902d2221..3cb0b921f 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/AuthorizationExternalSource/AuthorizationExternalSource.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/AuthorizationExternalSource/AuthorizationExternalSource.cs @@ -25,14 +25,14 @@ public class AuthorizationExternalSource _typedCache; - public AuthorizationExternalSource(TBLLContext context, IAuthorizationBLLContext authorizationBLLContext, ITypeResolver securityEntityTypeResolver) + public AuthorizationExternalSource(TBLLContext context, IAuthorizationBLLContext authorizationBLLContext, ISecurityTypeResolverContainer securityTypeResolverContainer) : base (context) { if (authorizationBLLContext == null) throw new ArgumentNullException(nameof(authorizationBLLContext)); - if (securityEntityTypeResolver == null) throw new ArgumentNullException(nameof(securityEntityTypeResolver)); + if (securityTypeResolverContainer == null) throw new ArgumentNullException(nameof(securityTypeResolverContainer)); this._authorizationBLLContext = authorizationBLLContext; - this._securityEntityTypeResolver = securityEntityTypeResolver; + this._securityEntityTypeResolver = securityTypeResolverContainer.SecurityTypeResolver; this._typedCache = new DictionaryCache(entityType => this.GetTypedInternal(entityType, true)); } diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/ContextEvaluator.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/ContextEvaluator.cs new file mode 100644 index 000000000..b2f8b1192 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/ContextEvaluator.cs @@ -0,0 +1,67 @@ +using System; +using System.Threading.Tasks; + +using Framework.Core.Services; +using Framework.DomainDriven.BLL; + +using JetBrains.Annotations; + +using Microsoft.Extensions.DependencyInjection; + +namespace Framework.DomainDriven.ServiceModel.IAD +{ + public class ContextEvaluator : IContextEvaluator + { + private readonly IServiceProvider rootServiceProvider; + + public ContextEvaluator([NotNull] IServiceProvider rootServiceProvider) + { + this.rootServiceProvider = rootServiceProvider ?? throw new ArgumentNullException(nameof(rootServiceProvider)); + } + + public async Task EvaluateAsync(DBSessionMode sessionMode, string customPrincipalName, Func> getResult) + { + await using var scope = this.rootServiceProvider.CreateAsyncScope(); + + var scopeServiceProvider = scope.ServiceProvider; + var session = scopeServiceProvider.GetRequiredService(); + + if (sessionMode == DBSessionMode.Read) + { + session.AsReadOnly(); + } + + var defaultPrincipalName = scopeServiceProvider.GetRequiredService().GetUserName(); + + var impersonateService = !string.IsNullOrWhiteSpace(customPrincipalName) && customPrincipalName != defaultPrincipalName + ? scopeServiceProvider.GetRequiredService() + : null; + + var context = scopeServiceProvider.GetRequiredService(); + + TResult result; + + try + { + if (impersonateService == null) + { + result = await getResult(context, session); + } + else + { + result = await impersonateService.WithImpersonateAsync(customPrincipalName, () => getResult(context, session)); + } + } + catch + { + session.AsFault(); + + throw; + } + + scopeServiceProvider.TryCloseDbSession(); + + return result; + } + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/IImpersonateService.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/IImpersonateService.cs new file mode 100644 index 000000000..2ccf88c0e --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/IImpersonateService.cs @@ -0,0 +1,9 @@ +using System; +using System.Threading.Tasks; + +namespace Framework.DomainDriven.ServiceModel.IAD; + +public interface IImpersonateService +{ + Task WithImpersonateAsync(string customUserName, Func> func); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/RootContextEvaluator.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/RootContextEvaluator.cs deleted file mode 100644 index 03b51f1a5..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/RootContextEvaluator.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; - -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; - -using JetBrains.Annotations; - -using Microsoft.Extensions.DependencyInjection; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public class RootContextEvaluator : IContextEvaluator - { - private readonly IServiceEnvironment serviceEnvironment; - - private readonly IServiceProvider rootServiceProvider; - - public RootContextEvaluator( - [NotNull] IServiceEnvironment serviceEnvironment, - [NotNull] IServiceProvider rootServiceProvider) - { - this.serviceEnvironment = serviceEnvironment ?? throw new ArgumentNullException(nameof(serviceEnvironment)); - this.rootServiceProvider = - rootServiceProvider ?? throw new ArgumentNullException(nameof(rootServiceProvider)); - } - - public TResult Evaluate(DBSessionMode sessionMode, string principalName, Func getResult) - { - using var scope = this.rootServiceProvider.CreateScope(); - - return new ScopedContextEvaluator(this.serviceEnvironment, scope.ServiceProvider).Evaluate(sessionMode, principalName, getResult); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/ScopedContextEvaluator.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/ScopedContextEvaluator.cs deleted file mode 100644 index 345c19f14..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ContextEvaluator/ScopedContextEvaluator.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; - -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; - -using JetBrains.Annotations; - -using Microsoft.Extensions.DependencyInjection; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public class ScopedContextEvaluator : IScopedContextEvaluator - { - private readonly IServiceEnvironment serviceEnvironment; - - private readonly IServiceProvider scopedServiceProvider; - - public ScopedContextEvaluator( - [NotNull] IServiceEnvironment serviceEnvironment, - [NotNull] IServiceProvider scopedServiceProvider) - { - this.serviceEnvironment = serviceEnvironment ?? throw new ArgumentNullException(nameof(serviceEnvironment)); - this.scopedServiceProvider = - scopedServiceProvider ?? throw new ArgumentNullException(nameof(scopedServiceProvider)); - } - - public TResult Evaluate( - DBSessionMode sessionMode, - string principalName, - Func getResult) - { - var evaluateScopeManager = this.scopedServiceProvider.GetRequiredService(); - - IBLLContextContainer contextContainer = null; - - try - { - return this.serviceEnvironment.SessionFactory.Evaluate( - sessionMode, - session => - { - contextContainer = this.serviceEnvironment.GetBLLContextContainer(this.scopedServiceProvider, session, principalName); - - evaluateScopeManager.BeginScope(contextContainer); - - return getResult(contextContainer.Context, session); - }); - } - finally - { - if (contextContainer != null) - { - evaluateScopeManager?.EndScope(contextContainer); - } - } - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/DenormalizeHierarchicalDALListener.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/DenormalizeHierarchicalDALListener.cs index e25f5d83d..75ee5d0f7 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/DenormalizeHierarchicalDALListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/DenormalizeHierarchicalDALListener.cs @@ -13,7 +13,7 @@ namespace Framework.DomainDriven.ServiceModel.IAD { - public class DenormalizeHierarchicalDALListener : BLLContextContainer, IDALListener + public class DenormalizeHierarchicalDALListener : BLLContextContainer, IBeforeTransactionCompletedDALListener where TBLLContext : class, IBLLBaseContextBase, ITrackingServiceContainer where TPersistentDomainObjectBase : class, IIdentityObject diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/FixDomainObjectEventRevisionNumberDALListener.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/FixDomainObjectEventRevisionNumberDALListener.cs index 9fc2e199e..2c8cbfa76 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/FixDomainObjectEventRevisionNumberDALListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/FixDomainObjectEventRevisionNumberDALListener.cs @@ -7,7 +7,7 @@ namespace Framework.DomainDriven.ServiceModel.IAD { - public class FixDomainObjectEventRevisionNumberDALListener : BLLContextContainer, IDALListener + public class FixDomainObjectEventRevisionNumberDALListener : BLLContextContainer, IBeforeTransactionCompletedDALListener { public FixDomainObjectEventRevisionNumberDALListener(IConfigurationBLLContext context) : base(context) diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/SubscriptionDALListener.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/SubscriptionDALListener.cs index 5800aa5f7..777ca7b05 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/SubscriptionDALListener.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DALListeners/SubscriptionDALListener.cs @@ -9,7 +9,7 @@ namespace Framework.DomainDriven.ServiceModel.IAD { - public class SubscriptionDALListener : IDALListener + public class SubscriptionDALListener : IBeforeTransactionCompletedDALListener { private readonly IPersistentTargetSystemService targetSystemService; @@ -25,6 +25,11 @@ public void Process(DALChangesEventArgs eventArgs) { if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); + if (!this.targetSystemService.TargetSystem.SubscriptionEnabled) + { + return; + } + this.targetSystemService.SubscriptionService.GetObjectModifications(eventArgs.Changes).Foreach(info => this.subscriptionService.ProcessChanged(new ObjectModificationInfoDTO(info))); } } diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DBSessionEventListener.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DBSessionEventListener.cs new file mode 100644 index 000000000..385220f5f --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/DBSessionEventListener.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Framework.Configuration.BLL; +using Framework.Core; +using Framework.DomainDriven.BLL; + +namespace Framework.DomainDriven.ServiceModel.IAD; + +public class DBSessionEventListener : IDBSessionEventListener +{ + private readonly IInitializeManager initializeManager; + + private readonly IConfigurationBLLContext configurationBllContext; + + private readonly IStandardSubscriptionService subscriptionService; + + private readonly IReadOnlyCollection flushedDalListener; + + private readonly IReadOnlyCollection beforeTransactionCompletedDalListener; + + private readonly IReadOnlyCollection afterTransactionCompletedDalListener; + + + public DBSessionEventListener( + IInitializeManager initializeManager, + IEnumerable flushedDalListener, + IEnumerable beforeTransactionCompletedDalListener, + IEnumerable afterTransactionCompletedDalListener, + IConfigurationBLLContext configurationBLLContext, + IStandardSubscriptionService subscriptionService) + { + this.initializeManager = initializeManager; + this.configurationBllContext = configurationBLLContext; + this.subscriptionService = subscriptionService; + + this.flushedDalListener = flushedDalListener.ToArray(); + this.beforeTransactionCompletedDalListener = beforeTransactionCompletedDalListener.ToArray(); + this.afterTransactionCompletedDalListener = afterTransactionCompletedDalListener.ToArray(); + } + + public void OnFlushed(DALChangesEventArgs eventArgs) + { + if (this.initializeManager.IsInitialize) + { + return; + } + + this.flushedDalListener.Foreach(listener => listener.Process(eventArgs)); + } + + public void OnBeforeTransactionCompleted(DALChangesEventArgs eventArgs) + { + if (this.initializeManager.IsInitialize) + { + return; + } + + this.beforeTransactionCompletedDalListener.Concat(this.GetSubscriptionDALListeners()).Foreach(listener => listener.Process(eventArgs)); + } + + public void OnAfterTransactionCompleted(DALChangesEventArgs eventArgs) + { + if (this.initializeManager.IsInitialize) + { + return; + } + + this.afterTransactionCompletedDalListener.Foreach(listener => listener.Process(eventArgs)); + } + + private IEnumerable GetSubscriptionDALListeners() + { + return from targetSystemService in this.configurationBllContext.GetPersistentTargetSystemServices() + + where targetSystemService.TargetSystem.SubscriptionEnabled + + select new SubscriptionDALListener(targetSystemService, this.subscriptionService); + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/DictionaryExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/DictionaryExtensions.cs deleted file mode 100644 index 611711229..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/DictionaryExtensions.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; - -using JetBrains.Annotations; - -namespace Framework.DomainDriven.ServiceModel -{ - internal static class DictionaryExtensions - { - public static void RegisterScope([NotNull] this Dictionary dict, T value) - { - if (dict == null) throw new ArgumentNullException(nameof(dict)); - - dict.Add(typeof(T), value); - } - - - public static bool TryRegisterScope([NotNull] this Dictionary dict, T value) - { - if (dict == null) throw new ArgumentNullException(nameof(dict)); - - return dict.TryAdd(typeof(T), value); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/EvaluateScopeManager.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/EvaluateScopeManager.cs deleted file mode 100644 index b49197734..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/EvaluateScopeManager.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; - -using Framework.DomainDriven.ServiceModel.IAD; - -using JetBrains.Annotations; - -namespace Framework.DomainDriven.ServiceModel -{ - public class EvaluateScopeManager : IEvaluateScopeManager - { - private IServiceEnvironmentBLLContextContainer currentBLLContextContainer; - - - public IServiceEnvironmentBLLContextContainer CurrentBLLContextContainer => this.currentBLLContextContainer ?? throw new InvalidOperationException("Invalid call time. Evaluate not started."); - - - public void BeginScope([NotNull] object bllContextContainer) - { - if (bllContextContainer == null) throw new ArgumentNullException(nameof(bllContextContainer)); - - if (this.currentBLLContextContainer != null) - { - throw new InvalidOperationException("Invalid call time. Evaluate not finished."); - } - - this.currentBLLContextContainer = (IServiceEnvironmentBLLContextContainer)bllContextContainer; - } - - public void EndScope([NotNull] object bllContextContainer) - { - if (bllContextContainer == null) throw new ArgumentNullException(nameof(bllContextContainer)); - - if (this.currentBLLContextContainer != bllContextContainer) - { - throw new InvalidOperationException("Invalid call time."); - } - - this.currentBLLContextContainer = null; - } - - IServiceEnvironmentBLLContextContainer IEvaluateScopeManager.CurrentBLLContextContainer => this.CurrentBLLContextContainer; - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/IEvaluateScopeManager.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/IEvaluateScopeManager.cs deleted file mode 100644 index f281efd0e..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/EvaluateScopeManager/IEvaluateScopeManager.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Framework.DomainDriven.ServiceModel.IAD; - -namespace Framework.DomainDriven.ServiceModel -{ - public interface IEvaluateScopeManager - { - IServiceEnvironmentBLLContextContainer CurrentBLLContextContainer { get; } - - void BeginScope(object bllContextContainer); - - void EndScope(object bllContextContainer); - } - - public interface IEvaluateScopeManager : IEvaluateScopeManager - { - new IServiceEnvironmentBLLContextContainer CurrentBLLContextContainer { get; } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Events/LocalDBEventMessageSender.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Events/LocalDBEventMessageSender.cs index f5ba7b3aa..21b66d07b 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Events/LocalDBEventMessageSender.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Events/LocalDBEventMessageSender.cs @@ -29,7 +29,7 @@ public abstract class LocalDBEventMessageSenderКонтекст системы /// Контекст утилит /// Таг, маркирующий очередь евентов - protected LocalDBEventMessageSender([NotNull] TBLLContext context, [NotNull] Framework.Configuration.BLL.IConfigurationBLLContext configurationContext, [NotNull] string queueTag = "default") + protected LocalDBEventMessageSender([NotNull] TBLLContext context, [NotNull] IConfigurationBLLContext configurationContext, [NotNull] string queueTag = "default") : base(context) { if (string.IsNullOrWhiteSpace(queueTag)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(queueTag)); } @@ -38,7 +38,7 @@ protected LocalDBEventMessageSender([NotNull] TBLLContext context, [NotNull] Fra this.queueTag = queueTag; } - public override void Send(IDomainOperationSerializeData domainObjectEventArgs, TransactionMessageMode sendMessageMode) + public override void Send(IDomainOperationSerializeData domainObjectEventArgs) { var dto = domainObjectEventArgs.CustomSendObject ?? this.ToEventDTOBase(domainObjectEventArgs); diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IBLLContextContainerModule.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IBLLContextContainerModule.cs deleted file mode 100644 index 9a919bf2b..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IBLLContextContainerModule.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; - -using Framework.DomainDriven.BLL; - -namespace Framework.DomainDriven.ServiceModel.IAD; - -public interface IBLLContextContainerModule -{ - IEnumerable GetBeforeTransactionCompletedListeners() - { - yield break; - } - - void SubscribeEvents(); -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IInitializeManager.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IInitializeManager.cs new file mode 100644 index 000000000..181288586 --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IInitializeManager.cs @@ -0,0 +1,10 @@ +using System; + +namespace Framework.DomainDriven.ServiceModel.IAD; + +public interface IInitializeManager +{ + bool IsInitialize { get; } + + void InitializeOperation(Action operation); +} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IRootServiceEnvironment.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IRootServiceEnvironment.cs deleted file mode 100644 index 313a65b0e..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IRootServiceEnvironment.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; - -namespace Framework.DomainDriven.ServiceModel.IAD; - -public interface IRootServiceEnvironment : IServiceEnvironment -{ - IServiceProvider RootServiceProvider { get; } - - SubscriptionMetadataStore SubscriptionMetadataStore { get; } - - TBLLContextContainer GetBLLContextContainer(IServiceProvider serviceProvider, IDBSession session, string currentPrincipalName = null); -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IServiceEnvironmentBLLContextContainer.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IServiceEnvironmentBLLContextContainer.cs deleted file mode 100644 index cdb9e8659..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IServiceEnvironmentBLLContextContainer.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -using Framework.Authorization.BLL; -using Framework.Configuration.BLL; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public interface IServiceEnvironmentBLLContextContainer : - IAuthorizationBLLContextContainer, - BLL.Configuration.IConfigurationBLLContextContainer - { - IDBSession Session { get; } - - IServiceProvider ScopedServiceProvider { get; } - } - - public interface IServiceEnvironmentBLLContextContainer : IServiceEnvironmentBLLContextContainer - { - TBLLContext MainContext { get; } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IServiceEnvironmentModule.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IServiceEnvironmentModule.cs deleted file mode 100644 index cadbd536a..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/IServiceEnvironmentModule.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; - -using Framework.DomainDriven.BLL; - -namespace Framework.DomainDriven.ServiceModel.IAD; - -public interface IServiceEnvironmentModule -{ - IEnumerable GetDALFlushedListeners(TBLLContextContainer container) - { - yield break; - } - - IEnumerable GetBeforeTransactionCompletedListeners(TBLLContextContainer container) - { - yield break; - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/IAuthorizationServiceEnvironment.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/IAuthorizationServiceEnvironment.cs deleted file mode 100644 index 182335f25..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/IAuthorizationServiceEnvironment.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Framework.Authorization.BLL; -using Framework.DomainDriven.ServiceModel.Service; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public interface IAuthorizationServiceEnvironment : IServiceEnvironment - { - - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/IConfigurationServiceEnvironment.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/IConfigurationServiceEnvironment.cs deleted file mode 100644 index 576b55c9f..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/IConfigurationServiceEnvironment.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Framework.DomainDriven.ServiceModel.Service; -using Framework.Configuration.BLL; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public interface IConfigurationServiceEnvironment : IServiceEnvironment - { - IObjectStorage ObjectStorage { get; } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/TimeoutStorage/IObjectStorage.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/TimeoutStorage/IObjectStorage.cs deleted file mode 100644 index 92f6734c6..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/TimeoutStorage/IObjectStorage.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public interface IObjectStorage - { - void Push(string key, T value); - - T Pop(string key); - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/TimeoutStorage/TimeoutStorage.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/TimeoutStorage/TimeoutStorage.cs deleted file mode 100644 index 6eb79ce22..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/Impl/TimeoutStorage/TimeoutStorage.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Framework.Core; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public class TimeoutStorage : IObjectStorage - { - private readonly IDateTimeService _dateTimeService; - - private readonly TimeSpan _liveTime; - - private readonly object _locker = new object(); - - private readonly Dictionary> _cache = new Dictionary>(); - - - public TimeoutStorage(IDateTimeService dateTimeService, TimeSpan liveTime) - { - this._dateTimeService = dateTimeService; - this._liveTime = liveTime; - } - - - public void ClearCache() - { - lock (this._locker) - { - var now = this._dateTimeService.Now; - - var timeoutKeys = from pair in this._cache - - where pair.Value.Key < now - - select pair.Key; - - timeoutKeys.ToList().Foreach(key => this._cache.Remove(key)); - } - } - - - public void Push(string key, T value) - { - lock (this._locker) - { - this.ClearCache(); - - this._cache.Add(key, (this._dateTimeService.Now + this._liveTime).ToKeyValuePair((object)value)); - } - } - - public T Pop(string key) - { - lock (this._locker) - { - this.ClearCache(); - - var res = (T)this._cache[key].Value; - - this._cache.Remove(key); - - return res; - } - } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/InitializeManager.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/InitializeManager.cs new file mode 100644 index 000000000..ada1c29cb --- /dev/null +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/InitializeManager.cs @@ -0,0 +1,34 @@ +using System; + +namespace Framework.DomainDriven.ServiceModel.IAD; + +public class InitializeManager : IInitializeManager +{ + /// + /// Флаг, указывающий, что происходит инициализация системы (в этом состояния отключены подписки на все евенты) + /// + public bool IsInitialize { get; private set; } + + public void InitializeOperation(Action operation) + { + if (operation == null) throw new ArgumentNullException(nameof(operation)); + + if (this.IsInitialize) + { + throw new Exception("already initializing"); + } + else + { + this.IsInitialize = true; + + try + { + operation(); + } + finally + { + this.IsInitialize = false; + } + } + } +} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceCollectionExtensions.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceCollectionExtensions.cs index 2d627d048..6d4cf7b33 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceCollectionExtensions.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceCollectionExtensions.cs @@ -2,8 +2,15 @@ using Framework.Authorization.BLL; using Framework.Configuration.BLL; +using Framework.Configuration.BLL.Notification; using Framework.Core; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.BLL.Security; +using Framework.Notification; +using Framework.QueryableSource; +using Framework.QueryLanguage; using Framework.SecuritySystem; +using Framework.SecuritySystem.Rules.Builders; using Microsoft.Extensions.DependencyInjection; @@ -11,74 +18,127 @@ namespace Framework.DomainDriven.ServiceModel.IAD { public static class ServiceCollectionExtensions { - public static IServiceCollection RegisterEvaluateScopeManager(this IServiceCollection services) + public static IServiceCollection RegisterGenericServices(this IServiceCollection services) { - return services - .AddScoped, EvaluateScopeManager>() - .AddScoped(sp => sp.GetRequiredService>()); + services.AddScoped(sp => sp.GetRequiredService().GetObjectStateService()); + + services.AddSingleton(); + + services.AddScoped(); + + return services; } public static IServiceCollection RegisterAuthorizationSystem(this IServiceCollection services) { - return services.AddScopedTransientByContainerBase>(c => c.Authorization); + return services.AddScopedFrom, IAuthorizationBLLContext>(); } public static IServiceCollection RegisterAuthorizationBLL(this IServiceCollection services) { return services - .AddScopedTransientByContainerBase(c => c.Authorization) - .AddScopedTransientByContainerBase>(c => c.Authorization) - .AddScopedTransientByContainerBase>(c => c.Authorization.SecurityService) - .AddScopedTransientByContainerBase(c => c.Authorization.SecurityService) - .AddScopedTransientByContainerBase(c => c.Authorization.GetQueryableSource()) - .AddScopedTransientByContainerBase(c => c.Authorization.SecurityExpressionBuilderFactory) - - .AddScoped, AccessDeniedExceptionService>() - .Self(AuthorizationSecurityServiceBase.Register) - .Self(AuthorizationBLLFactoryContainer.RegisterBLLFactory); + + .AddScoped(sp => sp.GetRequiredService().GetDALFactory()) + + .AddScoped, OperationEventSenderContainer>() + + .AddScoped>() + + .AddSingleton() + + .AddScoped(sp => + new AuthorizationValidator(sp.GetRequiredService(), sp.GetRequiredService())) + + .AddSingleton(new AuthorizationMainFetchService().WithCompress().WithCache().WithLock().Add(FetchService.OData)) + .AddScoped() + .AddScoped() + .AddScoped() + .AddScoped() + .AddScopedFromLazyInterfaceImplement() + .AddScopedFrom() + + .AddScopedFrom, IAuthorizationBLLContext>() + .AddScopedFrom, IAuthorizationSecurityService>() + .AddScopedFrom() + .AddScoped, BLLQueryableSource>() + .AddScoped, Framework.SecuritySystem.Rules.Builders.MaterializedPermissions.SecurityExpressionBuilderFactory>() + .AddScoped, AccessDeniedExceptionService>() + + .Self(AuthorizationSecurityServiceBase.Register) + .Self(AuthorizationBLLFactoryContainer.RegisterBLLFactory); } public static IServiceCollection RegisterConfigurationBLL(this IServiceCollection services) { return services - .AddScopedTransientByContainerBase(c => c.Configuration) - .AddScopedTransientByContainerBase>(c => c.Configuration) - .AddScopedTransientByContainerBase>(c => c.Configuration.SecurityService) - .AddScopedTransientByContainerBase(c => c.Configuration.SecurityService) - .AddScopedTransientByContainerBase(c => c.Configuration.GetQueryableSource()) - .AddScopedTransientByContainerBase(c => c.Configuration.SecurityExpressionBuilderFactory) + .AddScoped(sp => sp.GetRequiredService().GetDALFactory()) + + .AddScoped, OperationEventSenderContainer>() + .AddScoped>() + + .AddSingleton() + + .AddScoped(sp => + new ConfigurationValidator(sp.GetRequiredService(), sp.GetRequiredService())) + + + .AddSingleton(new ConfigurationMainFetchService().WithCompress().WithCache().WithLock().Add(FetchService.OData)) + .AddScoped() + .AddScoped() + + .AddScopedFrom() + + .AddScoped, TemplateMessageSender>() + .AddScoped, LocalDBNotificationEventDTOMessageSender>() + .AddScoped() + + + .AddScoped() + .AddScopedFromLazyInterfaceImplement() + + .AddScopedFrom, IConfigurationBLLContext>() + .AddScopedFrom, IConfigurationSecurityService>() + .AddScopedFrom() + .AddScoped, BLLQueryableSource>() + .AddScoped, Framework.SecuritySystem.Rules.Builders.MaterializedPermissions.SecurityExpressionBuilderFactory>() .AddScoped, AccessDeniedExceptionService>() + .Self(ConfigurationSecurityServiceBase.Register) .Self(ConfigurationBLLFactoryContainer.RegisterBLLFactory); } - - public static IServiceCollection AddScopedTransientByContainerBase(this IServiceCollection services, Func func) - where T : class + public static IServiceCollection AddScopedFromLazyInterfaceImplement(this IServiceCollection services) + where TImplementation: class, TInterface + where TInterface : class { - return services.AddScopedTransientFactory(sp => sp.GetRequiredService() - .Pipe(manager => FuncHelper.Create(() => func(manager.CurrentBLLContextContainer)))); + return services.AddScoped() + .AddScoped(sp => LazyInterfaceImplementHelper.CreateProxy(() => sp.GetRequiredService())); } - public static IServiceCollection AddScopedTransientByContainer(this IServiceCollection services, Func, T> func) - where T : class + public static IServiceCollection AddScopedFromLazy(this IServiceCollection services) + where TImplementation : class, TInterface + where TInterface : class { - return services.AddScopedTransientFactory(sp => sp.GetRequiredService>() - .Pipe(manager => FuncHelper.Create(() => func(manager.CurrentBLLContextContainer)))); + return services.AddScoped() + .AddScoped(sp => new Lazy(sp.GetRequiredService)) + .AddScoped(sp => sp.GetRequiredService>().Value); } - public static IServiceCollection AddScopedTransient(this IServiceCollection services, Func func) - where T : class + public static IServiceCollection AddScopedFrom(this IServiceCollection services) + where TImplementation : class, TSource + where TSource : class { - return services.AddScopedTransientFactory(sp => FuncHelper.Create(() => func(sp))); + return services.AddScoped(sp => sp.GetRequiredService()); } - public static IServiceCollection AddScopedTransientFactory(this IServiceCollection services, Func> getFunc) - where T : class + + public static IServiceCollection AddSingletonFrom(this IServiceCollection services) + where TImplementation : class, TSource + where TSource : class { - return services.AddScoped(sp => getFunc(sp).Pipe(LazyInterfaceImplementHelper.CreateCallProxy)); + return services.AddSingleton(sp => sp.GetRequiredService()); } } } diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.Evaluate.Authorization.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.Evaluate.Authorization.cs deleted file mode 100644 index 8ab7b994e..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.Evaluate.Authorization.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -using Framework.Authorization.BLL; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public abstract partial class ServiceEnvironmentBase : IServiceEnvironment - { - IContextEvaluator IServiceEnvironment.GetContextEvaluator(IServiceProvider currentScopedServiceProvider) - { - return currentScopedServiceProvider == null - ? new RootContextEvaluator(this, this.RootServiceProvider) - : new ScopedContextEvaluator(this, currentScopedServiceProvider); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.Evaluate.Configuration.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.Evaluate.Configuration.cs deleted file mode 100644 index 865eec308..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.Evaluate.Configuration.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; -using Framework.Configuration.BLL; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public abstract partial class ServiceEnvironmentBase : IServiceEnvironment - { - IContextEvaluator IServiceEnvironment.GetContextEvaluator(IServiceProvider currentScopedServiceProvider) - { - return currentScopedServiceProvider == null - ? new RootContextEvaluator(this, this.RootServiceProvider) - : new ScopedContextEvaluator(this, currentScopedServiceProvider); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.cs deleted file mode 100644 index ac6aee72f..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.0.cs +++ /dev/null @@ -1,568 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; - -using Framework.Authorization; -using Framework.Authorization.BLL; -using Framework.Configuration.BLL; -using Framework.Configuration.BLL.Notification; -using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; -using Framework.Core; -using Framework.Core.Serialization; -using Framework.Core.Services; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; -using Framework.SecuritySystem.Rules.Builders; -using Framework.DomainDriven.ServiceModel.Service; -using Framework.Events; -using Framework.HierarchicalExpand; -using Framework.Notification; -using Framework.Notification.DTO; -using Framework.Notification.New; -using Framework.Persistent; -using Framework.QueryLanguage; -using Framework.Report; -using Framework.SecuritySystem; -using Framework.Validation; - -using JetBrains.Annotations; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public abstract partial class ServiceEnvironmentBase : - IAuthorizationServiceEnvironment, - IConfigurationServiceEnvironment, - IDisposable - { - public readonly IFetchService AuthorizationFetchService; - - public readonly IFetchService ConfigurationFetchService; - - public readonly IUserAuthenticationService UserAuthenticationService; - - protected ServiceEnvironmentBase( - [NotNull] IServiceProvider serviceProvider, - [NotNull] IDBSessionFactory sessionFactory, - [NotNull] INotificationContext notificationContext, - [NotNull] IUserAuthenticationService userAuthenticationService, - ISubscriptionMetadataFinder subscriptionsMetadataFinder = null) - { - this.RootServiceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); - this.SessionFactory = sessionFactory ?? throw new ArgumentNullException(nameof(sessionFactory)); - - this.NotificationContext = notificationContext ?? throw new ArgumentNullException(nameof(notificationContext)); - - this.ObjectStorage = new TimeoutStorage(DateTimeService.Default, new TimeSpan(0, 0, 10, 0)); - - this.DefaultAuthorizationValidatorCompileCache = - - this.SessionFactory - .AvailableValues - .ToValidation() - .ToBLLContextValidationExtendedData() - .Pipe(extendedValidationData => new AuthorizationValidationMap(extendedValidationData)) - .ToCompileCache(); - - - this.DefaultConfigurationValidatorCompileCache = - - this.SessionFactory - .AvailableValues - .ToValidation() - .ToBLLContextValidationExtendedData() - .Pipe(extendedValidationData => new ConfigurationValidationMap(extendedValidationData)) - .ToCompileCache(); - - this.AuthorizationFetchService = new AuthorizationMainFetchService().WithCompress().WithCache().WithLock().Add(FetchService.OData); - - this.ConfigurationFetchService = new ConfigurationMainFetchService().WithCompress().WithCache().WithLock().Add(FetchService.OData); - - this.SubscriptionMetadataStore = new SubscriptionMetadataStore(subscriptionsMetadataFinder ?? new SubscriptionMetadataFinder()); - - this.UserAuthenticationService = userAuthenticationService ?? throw new ArgumentNullException(nameof(userAuthenticationService)); - } - - /// - /// Кеш валидатора для авторизации - /// - protected ValidatorCompileCache DefaultAuthorizationValidatorCompileCache { get; } - - /// - /// Кеш валидатора для воркфлоу - /// - protected ValidatorCompileCache DefaultConfigurationValidatorCompileCache { get; } - - /// - /// Провайдер используется для создания scope в интеграционных тестах - /// - public IServiceProvider RootServiceProvider { get; } - - /// - /// Gets the notification context. - /// - /// - /// The notification context. - /// - public INotificationContext NotificationContext { get; } - - public IDBSessionFactory SessionFactory { get; } - - public virtual bool IsDebugMode => Debugger.IsAttached; - - /// - /// Флаг, указывающий, что происходит инициализация системы (в этом состояния отключены подписки на все евенты) - /// - public bool IsInitialize { get; private set; } - - public IObjectStorage ObjectStorage { get; private set; } - - /// - /// Получает хранилище описаний подписок. - /// - /// - /// Хранилище описаний подписок. - /// - public SubscriptionMetadataStore SubscriptionMetadataStore { get; } - - public abstract ServiceEnvironmentBLLContextContainer GetBLLContextContainerBase(IServiceProvider serviceProvider, IDBSession session, string currentPrincipalName = null); - - #region IServiceEnvironment Members - - IBLLContextContainer IServiceEnvironment.GetBLLContextContainer(IServiceProvider serviceProvider, IDBSession session, string currentPrincipalName) - { - return this.GetBLLContextContainerBase(serviceProvider, session, currentPrincipalName); - } - - #endregion - - #region IServiceEnvironment Members - - IBLLContextContainer IServiceEnvironment.GetBLLContextContainer(IServiceProvider serviceProvider, IDBSession session, string currentPrincipalName) - { - return this.GetBLLContextContainerBase(serviceProvider, session, currentPrincipalName); - } - - #endregion - - protected void InitializeOperation(Action operation) - { - if (operation == null) throw new ArgumentNullException(nameof(operation)); - - if (this.IsInitialize) - { - throw new Exception("already initializing"); - } - else - { - this.IsInitialize = true; - - try - { - operation(); - } - finally - { - this.IsInitialize = false; - } - } - } - - /// - public void Dispose() - { - this.SessionFactory.Dispose(); - } - - public abstract class ServiceEnvironmentBLLContextContainer : - - IServiceEnvironmentBLLContextContainer, - - IBLLContextContainer, - IBLLContextContainer - { - protected readonly ServiceEnvironmentBase ServiceEnvironment; - - private readonly string currentPrincipalName; - - private readonly IEnumerable targetSystems; - - - - protected readonly BLLOperationEventListenerContainer - AuthorizationOperationListeners = - new BLLOperationEventListenerContainer(); - - protected readonly BLLSourceEventListenerContainer - AuthorizationSourceListeners = - new BLLSourceEventListenerContainer(); - - - protected readonly BLLOperationEventListenerContainer - ConfigurationOperationListeners = - new BLLOperationEventListenerContainer(); - - protected readonly BLLSourceEventListenerContainer - ConfigurationSourceListeners = - new BLLSourceEventListenerContainer(); - - - private readonly Lazy> lazyAuthorizationEventsSubscriptionManager; - - private readonly Lazy> lazyConfigurationEventsSubscriptionManager; - - - protected ServiceEnvironmentBLLContextContainer([NotNull] ServiceEnvironmentBase serviceEnvironment, [NotNull] IServiceProvider scopedServiceProvider, [NotNull] IDBSession session, string currentPrincipalName) - { - this.ServiceEnvironment = serviceEnvironment ?? throw new ArgumentNullException(nameof(serviceEnvironment)); - this.ScopedServiceProvider = scopedServiceProvider ?? throw new ArgumentNullException(nameof(scopedServiceProvider)); - this.Session = session ?? throw new ArgumentNullException(nameof(session)); - - this.currentPrincipalName = currentPrincipalName; - - this.StandartExpressionBuilder = LazyInterfaceImplementHelper.CreateProxy(this.GetStandartExpressionBuilder); - - this.NotificationService = LazyInterfaceImplementHelper.CreateProxy(this.CreateNotificationService); - - this.targetSystems = LazyHelper.Create(() => this.GetConfigurationTargetSystemServices(serviceEnvironment.SubscriptionMetadataStore)).Unwrap(); - - this.Authorization = LazyInterfaceImplementHelper.CreateProxy(this.CreateAuthorizationBLLContext); - - this.Configuration = LazyInterfaceImplementHelper.CreateProxy(this.CreateConfigurationBLLContext); - - this.HierarchicalObjectExpanderFactory = LazyInterfaceImplementHelper.CreateProxy(this.GetHierarchicalObjectExpanderFactory); - - this.SystemConstantSerializerFactory = SerializerFactory.Default; - - this.lazyAuthorizationEventsSubscriptionManager = LazyHelper.Create(this.CreateAuthorizationEventsSubscriptionManager); - - this.lazyConfigurationEventsSubscriptionManager = LazyHelper.Create(this.CreateConfigurationEventsSubscriptionManager); - } - - public IServiceProvider ScopedServiceProvider { get; } - - - public IAuthorizationBLLContext Authorization { get; } - - public IConfigurationBLLContext Configuration { get; } - - public IDBSession Session { get; } - - - protected IEventsSubscriptionManager AuthorizationEventsSubscriptionManager => this.lazyAuthorizationEventsSubscriptionManager.Value; - - protected IEventsSubscriptionManager ConfigurationEventsSubscriptionManager => this.lazyConfigurationEventsSubscriptionManager.Value; - - #region IBLLContextContainer Members - - IAuthorizationBLLContext IBLLContextContainer.Context - { - get { return this.Authorization; } - } - - #endregion - - #region IBLLContextContainer Members - - IConfigurationBLLContext IBLLContextContainer.Context - { - get { return this.Configuration; } - } - - #endregion - - protected INotificationService NotificationService { get; } - - public IStandartExpressionBuilder StandartExpressionBuilder { get; } - - public IHierarchicalObjectExpanderFactory HierarchicalObjectExpanderFactory { get; } - - protected virtual ISerializerFactory SystemConstantSerializerFactory { get; } - - protected virtual IEnumerable GetModules() - { - yield break; - } - - protected virtual IAuthorizationBLLContext CreateAuthorizationBLLContext() - { - return new AuthorizationBLLContext( - this.ScopedServiceProvider, - this.Session.GetDALFactory(), - this.AuthorizationOperationListeners, - this.AuthorizationSourceListeners, - this.Session.GetObjectStateService(), - this.GetAccessDeniedExceptionService(), - this.StandartExpressionBuilder, - LazyInterfaceImplementHelper.CreateProxy(this.CreateAuthorizationValidator), - this.HierarchicalObjectExpanderFactory, - this.ServiceEnvironment.AuthorizationFetchService, - this.GetDateTimeService(), - this.GetUserAuthenticationService(), - LazyInterfaceImplementHelper.CreateProxy(() => this.GetSecurityExpressionBuilderFactory(this.Authorization)), - this.Configuration, - LazyInterfaceImplementHelper.CreateProxy(() => new AuthorizationSecurityService(this.Authorization)), - LazyInterfaceImplementHelper.CreateProxy(() => new AuthorizationBLLFactoryContainer(this.Authorization)), - LazyInterfaceImplementHelper.CreateProxy(this.GetAuthorizationExternalSource), - LazyInterfaceImplementHelper.CreateProxy(() => new AuthorizationRunAsManger(this.Authorization)), - principalName => this.Impersonate(principalName).Authorization, - LazyInterfaceImplementHelper.CreateProxy(this.GetSecurityTypeResolver)); - } - - protected virtual IConfigurationBLLContext CreateConfigurationBLLContext() - { - return new ConfigurationBLLContext( - this.ScopedServiceProvider, - this.Session.GetDALFactory(), - this.ConfigurationOperationListeners, - this.ConfigurationSourceListeners, - this.Session.GetObjectStateService(), - this.GetAccessDeniedExceptionService(), - this.StandartExpressionBuilder, - LazyInterfaceImplementHelper.CreateProxy(this.CreateConfigurationValidator), - this.HierarchicalObjectExpanderFactory, - this.ServiceEnvironment.ConfigurationFetchService, - this.GetDateTimeService(), - LazyInterfaceImplementHelper.CreateProxy(() => this.GetSecurityExpressionBuilderFactory(this.Configuration)), - this.NotificationService.ExceptionSender, - this.NotificationService.SubscriptionSender, - () => new ConfigurationSecurityService(this.Configuration), - () => new ConfigurationBLLFactoryContainer(this.Configuration), - this.Authorization, - this.GetEmployeeSource, - this.targetSystems, - this.SystemConstantSerializerFactory, - LazyInterfaceImplementHelper.CreateProxy(this.GetExceptionService), - this.Session.GetCurrentRevision); - } - - - /// - /// Создание валидатора для авторизации - /// - /// - protected virtual AuthorizationValidator CreateAuthorizationValidator() - { - return new AuthorizationValidator(this.Authorization, this.ServiceEnvironment.DefaultAuthorizationValidatorCompileCache); - } - - /// - /// Создание валидатора для утилит - /// - /// - protected virtual ConfigurationValidator CreateConfigurationValidator() - { - return new ConfigurationValidator(this.Configuration, this.ServiceEnvironment.DefaultConfigurationValidatorCompileCache); - } - - /// - /// Подписка на евенты - /// - protected internal virtual void SubscribeEvents() - { - this.Session.Flushed += (_, eventArgs) => - { - var listeners = this.GetDALFlushedListeners().ToArray(); - - listeners.Foreach(listener => listener.Process(eventArgs)); - }; - - this.Session.BeforeTransactionCompleted += (_, eventArgs) => - { - var listeners = this.GetBeforeTransactionCompletedListeners().ToArray(); - - listeners.Foreach(listener => listener.Process(eventArgs)); - }; - - this.Session.AfterTransactionCompleted += (_, eventArgs) => - { - var listeners = this.GetAfterTransactionCompletedListeners().ToArray(); - - listeners.Foreach(listener => listener.Process(eventArgs)); - }; - - this.AuthorizationEventsSubscriptionManager.Maybe(eventManager => eventManager.Subscribe()); - - this.ConfigurationEventsSubscriptionManager.Maybe(eventManager => eventManager.Subscribe()); - - foreach (var module in this.GetModules()) - { - module.SubscribeEvents(); - } - } - - protected virtual IEnumerable GetBeforeTransactionCompletedListeners() - { - foreach (var module in this.GetModules()) - { - foreach (var listener in module.GetBeforeTransactionCompletedListeners()) - { - yield return listener; - } - } - } - - protected abstract IEnumerable GetAfterTransactionCompletedListeners(); - - [Obsolete("Use GetBeforeTransactionCompletedListeners or GetAfterTransactionCompletedListeners methods", true)] - protected virtual IEnumerable GetTransactionCompletedListeners() - { - throw new NotImplementedException(); - } - - protected abstract IEnumerable GetDALFlushedListeners(); - - - protected virtual IEventsSubscriptionManager CreateAuthorizationEventsSubscriptionManager() - { - return null; - } - - protected virtual IEventsSubscriptionManager CreateConfigurationEventsSubscriptionManager() - { - return null; - } - - public virtual ISecurityExpressionBuilderFactory GetSecurityExpressionBuilderFactory(TBLLContext context) - where TPersistentDomainObjectBase : class, IIdentityObject - where TBLLContext : class, ISecurityBLLContext, TPersistentDomainObjectBase, TIdent>, IHierarchicalObjectExpanderFactoryContainer - { - return new Framework.SecuritySystem.Rules.Builders.MaterializedPermissions.SecurityExpressionBuilderFactory(context.HierarchicalObjectExpanderFactory, context.Authorization); - } - - protected virtual INotificationService CreateNotificationService() - { - var templateSender = this.GetMainTemplateSender().ToMessageTemplateSender(this.Configuration, this.ServiceEnvironment.NotificationContext.Sender); - - var notificationSender = this.GetMainTemplateSender().ToNotificationSender(this.Configuration, this.ServiceEnvironment.NotificationContext.Sender); - - var subscriptionMessageSender = this.GetSubscriptionTemplateSender().ToMessageTemplateSender(this.Configuration, this.ServiceEnvironment.NotificationContext.Sender); - - var exceptionSender = this.GetExceptionSender(); - - return new NotificationService(templateSender, notificationSender, subscriptionMessageSender, exceptionSender); - } - - /// - /// Создаёт экземпляр класса, который рассылает уведомления об исключениях. - /// - /// Экземпляр класса, который рассылает уведомления об исключениях. - protected virtual IMessageSender GetExceptionSender() - { - return SmtpMessageSender.Configuration.ToExceptionSender( - this.Configuration, - this.ServiceEnvironment.NotificationContext.Sender, - this.ServiceEnvironment.NotificationContext.ExceptionReceivers); - } - - public virtual IDateTimeService GetDateTimeService() - { - return DateTimeService.Default; - } - - protected virtual IUserAuthenticationService GetUserAuthenticationService() - { - if (string.IsNullOrWhiteSpace(this.currentPrincipalName)) - { - return this.ServiceEnvironment.UserAuthenticationService; - } - - return Core.Services.UserAuthenticationService.CreateFor(this.currentPrincipalName); - } - - protected virtual IMessageSender GetMainTemplateSender() - { - return this.GetMessageTemplateSender(); - } - - protected virtual IMessageSender GetSubscriptionTemplateSender() - { - return this.GetMessageTemplateSender(); - } - - protected virtual IMessageSender GetMessageTemplateSender() - { - ////return new LocalDBNotificationEventDTOMessageSender(this.Configuration); // Сохранение нотификаций в локальной бд, откуда их будет забирать Biztalk - return this.ServiceEnvironment.NotificationContext.MSMQNotificationMessageSender; // Отсылка нотификаций в Biztalk через MSMQ - } - - protected virtual IStandartExpressionBuilder GetStandartExpressionBuilder() - { - return Framework.QueryLanguage.StandartExpressionBuilder.Default; - } - - /// - /// Получение сервиса обрабоки исключений - /// - /// - protected virtual IExceptionService GetExceptionService() - { - return new ExceptionService(this.Configuration); - } - - protected virtual IEnumerable GetConfigurationTargetSystemServices( - SubscriptionMetadataStore subscriptionMetadataStore) - { - yield break; - } - - protected abstract ITypeResolver GetSecurityTypeResolver(); - - - protected abstract IAuthorizationExternalSource GetAuthorizationExternalSource(); - - protected abstract IBLLSimpleQueryBase GetEmployeeSource(BLLSecurityMode securityMode); - - protected abstract IHierarchicalObjectExpanderFactory GetHierarchicalObjectExpanderFactory(); - - public virtual IAccessDeniedExceptionService GetAccessDeniedExceptionService() - where TPersistentDomainObjectBase : class, IIdentityObject - { - return new AccessDeniedExceptionService(); - } - - protected Framework.Configuration.BLL.ITargetSystemService GetConfigurationConfigurationTargetSystemService() - { - return new Framework.Configuration.BLL.TargetSystemService( - this.Configuration, - this.Configuration, - this.Configuration.Logics.TargetSystem.GetByName(TargetSystemHelper.ConfigurationName, true), - this.GetConfigurationEventDALListeners(), - this.ServiceEnvironment.SubscriptionMetadataStore); - } - - protected Framework.Configuration.BLL.ITargetSystemService GetAuthorizationConfigurationTargetSystemService() - { - return new Framework.Configuration.BLL.TargetSystemService( - this.Configuration, - this.Authorization, - this.Configuration.Logics.TargetSystem.GetByName(TargetSystemHelper.AuthorizationName, true), - this.GetAuthorizationEventDALListeners(), - this.ServiceEnvironment.SubscriptionMetadataStore); - } - - public ServiceEnvironmentBLLContextContainer Impersonate(string principalName) - { - return this.ServiceEnvironment.GetBLLContextContainerBase(this.ScopedServiceProvider, this.Session, principalName); - } - - /// - /// Получение авторизацонных DALListener-ов с возможностью ручных вызовов - /// - /// - protected virtual IEnumerable> GetAuthorizationEventDALListeners() - { - yield break; - } - - /// - /// Получение конфигурационных DALListener-ов с возможностью ручных вызовов - /// - /// - protected virtual IEnumerable> GetConfigurationEventDALListeners() - { - yield break; - } - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.1.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.1.cs deleted file mode 100644 index 1cb3f0bf7..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.1.cs +++ /dev/null @@ -1,194 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Framework.Core; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; -using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; -using Framework.Core.Services; - -using Microsoft.Extensions.DependencyInjection; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public abstract partial class ServiceEnvironmentBase : ServiceEnvironmentBase, IRootServiceEnvironment - where TBLLContextContainer : ServiceEnvironmentBase.ServiceEnvironmentBLLContextContainer - where TBLLContext : ITypeResolverContainer - { - protected ServiceEnvironmentBase( - IServiceProvider serviceProvider, - IDBSessionFactory sessionFactory, - INotificationContext notificationContext, - IUserAuthenticationService userAuthenticationService, - ISubscriptionMetadataFinder subscriptionsMetadataFinder = null) - : base(serviceProvider, sessionFactory, notificationContext, userAuthenticationService, subscriptionsMetadataFinder) - { - this.ServiceProvider = serviceProvider; - } - - public IServiceProvider ServiceProvider { get; } - - protected virtual IEnumerable> GetModules() - { - yield break; - } - - protected virtual IEnumerable GetDALFlushedListeners(TBLLContextContainer container) - { - foreach (var module in this.GetModules()) - { - foreach (var listener in module.GetDALFlushedListeners(container)) - { - yield return listener; - } - } - } - - protected virtual IEnumerable GetBeforeTransactionCompletedListeners(TBLLContextContainer container) - { - foreach (var module in this.GetModules()) - { - foreach (var listener in module.GetBeforeTransactionCompletedListeners(container)) - { - yield return listener; - } - } - - if (container.Configuration.SubscriptionEnabled) - { - foreach (var listener in this.GetSubscriptionDALListeners(container)) - { - yield return listener; - } - } - - yield return this.GetFixDomainObjectEventRevisionNumberDALListener(container); - } - - protected virtual IDALListener GetFixDomainObjectEventRevisionNumberDALListener(TBLLContextContainer container) - { - return new FixDomainObjectEventRevisionNumberDALListener(container.Configuration); - } - - protected virtual IEnumerable GetAfterTransactionCompletedListeners(TBLLContextContainer container) - { - yield break; - } - - private IEnumerable GetSubscriptionDALListeners(TBLLContextContainer container) - { - return from targetSystemService in container.Configuration.GetPersistentTargetSystemServices() - - where targetSystemService.TargetSystem.SubscriptionEnabled - - select new SubscriptionDALListener(targetSystemService, container.SubscriptionService); - } - - IBLLContextContainer IServiceEnvironment.GetBLLContextContainer(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName) - { - return this.GetBLLContextContainer(scopedServiceProvider, session, currentPrincipalName); - } - - public IContextEvaluator GetContextEvaluator( - IServiceProvider currentScopedServiceProvider = null) - { - return currentScopedServiceProvider == null - ? new RootContextEvaluator(this, this.RootServiceProvider) - : new ScopedContextEvaluator(this, currentScopedServiceProvider); - } - - public TBLLContextContainer GetBLLContextContainer(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName = null) - { - var container = this.CreateBLLContextContainer(scopedServiceProvider, session, currentPrincipalName); - - if (!this.IsInitialize) - { - container.SubscribeEvents(); - } - - return container; - } - - protected abstract TBLLContextContainer CreateBLLContextContainer(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName = null); - - public sealed override ServiceEnvironmentBase.ServiceEnvironmentBLLContextContainer GetBLLContextContainerBase(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName = null) - { - return this.GetBLLContextContainer(scopedServiceProvider, session, currentPrincipalName); - } - - public new abstract class ServiceEnvironmentBLLContextContainer : ServiceEnvironmentBase.ServiceEnvironmentBLLContextContainer, IServiceEnvironmentBLLContextContainer, IBLLContextContainer - { - private readonly ServiceEnvironmentBase serviceEnvironment; - - protected ServiceEnvironmentBLLContextContainer(ServiceEnvironmentBase serviceEnvironment, IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName) - : base(serviceEnvironment, scopedServiceProvider, session, currentPrincipalName) - { - this.serviceEnvironment = serviceEnvironment; - this.MainContext = LazyInterfaceImplementHelper.CreateProxy(this.CreateMainContext); - this.SubscriptionService = LazyInterfaceImplementHelper.CreateProxy(this.CreateSubscriptionService); - } - - public TBLLContext MainContext { get; } - - protected internal IStandardSubscriptionService SubscriptionService { get; } - - protected abstract TBLLContext CreateMainContext(); - - protected override ITypeResolver GetSecurityTypeResolver() - { - return this.MainContext.TypeResolver; - } - - /// - /// Вервис который будет отправлять подписки в шину или базу - /// На текущий момент возможны две реализации: - /// return new LocalDBSubscriptionService(this.Configuration); // Сохранение модификаций в локальную бд - /// или - /// return new DefaultActiveSubscriptionServiceClient(); // Отсылка модификаций в MSMQ - /// Так же можно использовать либо TraceActiveSubscriptionService, либо EmptyActiveSubscriptionService - /// - /// - protected abstract IStandardSubscriptionService CreateSubscriptionService(); - - #region IBLLContextContainer Members - - TBLLContext IBLLContextContainer.Context - { - get { return this.MainContext; } - } - - #endregion - - /// - /// Возврат DAL-подписчиков, при их вызове изменения в базе данных всё ещё доступны - /// - /// - protected override IEnumerable GetBeforeTransactionCompletedListeners() - { - var dalListeners = new[] - { - this.serviceEnvironment.GetBeforeTransactionCompletedListeners((TBLLContextContainer)this), - this.GetAuthorizationEventDALListeners(), - this.GetConfigurationEventDALListeners(), - }; - - return base.GetBeforeTransactionCompletedListeners().Concat(dalListeners.SelectMany()); - } - - /// - /// Возврат DAL-подписчиков, при их вызове изменения в базе данных уже недоступны - /// - /// - protected override IEnumerable GetAfterTransactionCompletedListeners() - { - return this.serviceEnvironment.GetAfterTransactionCompletedListeners((TBLLContextContainer)this); - } - - protected override IEnumerable GetDALFlushedListeners() - { - return this.serviceEnvironment.GetDALFlushedListeners((TBLLContextContainer)this); - } - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.2.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.2.cs deleted file mode 100644 index df2c4555f..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.2.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Collections.Generic; -using Framework.Authorization.BLL; -using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; -using Framework.Core; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; -using Framework.Persistent; -using Framework.Core.Services; -using Framework.Events; -using Framework.HierarchicalExpand; - -using ITargetSystemService = Framework.Configuration.BLL.ITargetSystemService; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public abstract class ServiceEnvironmentBase : ServiceEnvironmentBase - - where TBLLContextContainer : ServiceEnvironmentBase.ServiceEnvironmentBLLContextContainer - - where TBLLContext : class, IBLLBaseContextBase, - ISecurityServiceContainer>, - ISecurityBLLContext, - IAccessDeniedExceptionServiceContainer, - ITypeResolverContainer, IBLLOperationEventContext - where TPersistentDomainObjectBase : class, IDefaultIdentityObject - where TAuditPersistentDomainObjectBase : class, TPersistentDomainObjectBase, IDefaultAuditPersistentDomainObjectBase - - where TSecurityOperationCode : struct, Enum - { - protected ServiceEnvironmentBase( - IServiceProvider serviceProvider, - IDBSessionFactory sessionFactory, - INotificationContext notificationContext, - IUserAuthenticationService userAuthenticationService, - ISubscriptionMetadataFinder subscriptionsMetadataFinder = null) - - : base(serviceProvider, sessionFactory, notificationContext, userAuthenticationService, subscriptionsMetadataFinder) - { - } - - - public new abstract class ServiceEnvironmentBLLContextContainer : ServiceEnvironmentBase.ServiceEnvironmentBLLContextContainer - { - private readonly ServiceEnvironmentBase serviceEnvironment; - - private readonly Lazy> lazyMainEventsSubscriptionManager; - - protected ServiceEnvironmentBLLContextContainer(ServiceEnvironmentBase serviceEnvironment, IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName) - : base(serviceEnvironment, scopedServiceProvider, session, currentPrincipalName) - { - this.serviceEnvironment = serviceEnvironment; - - this.lazyMainEventsSubscriptionManager = LazyHelper.Create(this.CreateMainEventsSubscriptionManager); - } - - protected IEventsSubscriptionManager MainEventsSubscriptionManager => this.lazyMainEventsSubscriptionManager.Value; - - protected virtual ITypeResolver SecurityObjectTypeResolver => this.MainContext.TypeResolver; - - - protected virtual IEventsSubscriptionManager CreateMainEventsSubscriptionManager() - { - return null; - } - - /// - protected internal override void SubscribeEvents() - { - base.SubscribeEvents(); - - this.MainEventsSubscriptionManager.Maybe(eventManager => eventManager.Subscribe()); - } - - protected override IAuthorizationExternalSource GetAuthorizationExternalSource() - { - return new AuthorizationExternalSource(this.MainContext, this.Authorization, this.SecurityObjectTypeResolver); - } - - protected override IHierarchicalObjectExpanderFactory GetHierarchicalObjectExpanderFactory() - { - return new HierarchicalObjectExpanderFactory(this.MainContext.GetQueryableSource(), new ProjectionHierarchicalRealTypeResolver()); - } - - protected TBLLContext Impersonate(string principalName) - { - return this.serviceEnvironment.GetBLLContextContainer(this.ScopedServiceProvider, this.Session, principalName).MainContext; - } - - protected override IEnumerable GetConfigurationTargetSystemServices(SubscriptionMetadataStore subscriptionMetadataStore) - { - yield return this.GetConfigurationConfigurationTargetSystemService(); - } - - protected Framework.Configuration.BLL.ITargetSystemService GetMainConfigurationTargetSystemService() - { - return new Framework.Configuration.BLL.TargetSystemService( - this.Configuration, - this.MainContext, - this.Configuration.Logics.TargetSystem.GetObjectBy(ts => ts.IsMain, true), - this.GetMainEventDALListeners(), - this.ServiceEnvironment.SubscriptionMetadataStore); - } - - /// - protected override IEnumerable GetBeforeTransactionCompletedListeners() - { - foreach (var baseListener in base.GetBeforeTransactionCompletedListeners()) - { - yield return baseListener; - } - - foreach (var listener in this.GetMainEventDALListeners()) - { - yield return listener; - } - } - - /// - /// Получение DALListener-ов основной системы с возможностью ручных вызовов - /// - /// - protected virtual IEnumerable> GetMainEventDALListeners() - { - yield break; - } - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.3.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.3.cs deleted file mode 100644 index 75fbf18ad..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.IAD/ServiceEnvironmentBase.3.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; - -using Framework.Authorization.BLL; -using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; -using Framework.Configuration.Domain; -using Framework.Core; -using Framework.Core.Services; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; -using Framework.DomainDriven.BLL.Security.Lock; -using Framework.DomainDriven.BLL.Tracking; -using Framework.Persistent; - -namespace Framework.DomainDriven.ServiceModel.IAD -{ - public abstract class ServiceEnvironmentBase - : ServiceEnvironmentBase - - where TBLLContextContainer : ServiceEnvironmentBase.ServiceEnvironmentBLLContextContainer - where TBLLContext : class, IBLLBaseContextBase, - ISecurityServiceContainer>, - ISecurityBLLContext, - IAccessDeniedExceptionServiceContainer, - ITypeResolverContainer, - ITrackingServiceContainer, - IBLLOperationEventContext - where TPersistentDomainObjectBase : class, IDefaultIdentityObject - where TSecurityOperationCode : struct, Enum - - where TNamedLockObject : class, TPersistentDomainObjectBase, INamedLock - where TNamedLockOperation : struct, Enum - where TAuditPersistentDomainObjectBase : class, TPersistentDomainObjectBase, IDefaultAuditPersistentDomainObjectBase - { - protected ServiceEnvironmentBase( - IServiceProvider serviceProvider, - IDBSessionFactory sessionFactory, - INotificationContext notificationContext, - IUserAuthenticationService userAuthenticationService, - ISubscriptionMetadataFinder subscriptionsMetadataFinder = null) - : base(serviceProvider, sessionFactory, notificationContext, userAuthenticationService, subscriptionsMetadataFinder) - { - } - - protected override IEnumerable GetBeforeTransactionCompletedListeners(TBLLContextContainer container) - { - foreach (var listener in base.GetBeforeTransactionCompletedListeners(container)) - { - yield return listener; - } - - yield return new DenormalizeHierarchicalDALListener(container.MainContext); - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.Tests.Unit/Framework.DomainDriven.ServiceModel.Tests.Unit.csproj b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.Tests.Unit/Framework.DomainDriven.ServiceModel.Tests.Unit.csproj index 89129728f..75b177073 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel.Tests.Unit/Framework.DomainDriven.ServiceModel.Tests.Unit.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel.Tests.Unit/Framework.DomainDriven.ServiceModel.Tests.Unit.csproj @@ -3,10 +3,10 @@ false - - - - + + + + diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Framework.DomainDriven.ServiceModel.csproj b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Framework.DomainDriven.ServiceModel.csproj index 649e9f40e..51cfeebc0 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Framework.DomainDriven.ServiceModel.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Framework.DomainDriven.ServiceModel.csproj @@ -5,25 +5,14 @@ - + - - True - True - Settings.settings - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Mail/NotificationContext.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Mail/NotificationContext.cs deleted file mode 100644 index cde97da08..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Mail/NotificationContext.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.Net.Mail; - -using Framework.Core; -using Framework.Notification; -using Framework.Notification.DTO; - -namespace Framework.DomainDriven.ServiceModel -{ - /// - /// Контект для уведомления/нотификаций - /// - public interface INotificationContext : IMailAddressContainer - { - /// - /// Sender для отправки нотификаций в biztalk через MSMQ - /// - IMessageSender MSMQNotificationMessageSender { get; } - - /// - /// Список получателей серверных ошибок - /// - ReadOnlyCollection ExceptionReceivers { get; } - } - - public class NotificationContext : INotificationContext - { - public NotificationContext(IMessageSender notificationMessageSender, string sender, params string[] receivers) - : this(notificationMessageSender, new MailAddress(sender, sender), receivers) - { - } - - public NotificationContext(IMessageSender msmqNotificationMessageSender, MailAddress sender, params string[] receivers) - { - if (sender == null) throw new ArgumentNullException(nameof(sender)); - if (receivers == null) throw new ArgumentNullException(nameof(receivers)); - if (string.IsNullOrWhiteSpace(sender.DisplayName)) throw new System.ArgumentException("Not initialize sender name in NotificationContext"); - - this.MSMQNotificationMessageSender = msmqNotificationMessageSender ?? throw new ArgumentNullException(nameof(msmqNotificationMessageSender)); - this.Sender = sender; - this.ExceptionReceivers = receivers.ToReadOnlyCollection(); - } - - /// - public IMessageSender MSMQNotificationMessageSender { get; } - - public MailAddress Sender { get; } - - /// - public ReadOnlyCollection ExceptionReceivers { get; } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Properties/Settings.Designer.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Properties/Settings.Designer.cs deleted file mode 100644 index 49be3895f..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Properties/Settings.Designer.cs +++ /dev/null @@ -1,35 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Framework.DomainDriven.ServiceModel.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("")] - public string ServiceEnvironmentFactoryType { - get { - return ((string)(this["ServiceEnvironmentFactoryType"])); - } - } - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Properties/Settings.settings b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Properties/Settings.settings deleted file mode 100644 index 7819a5ca0..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Properties/Settings.settings +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/EvaluatedData.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/EvaluatedData.cs index d2f6ae67d..4beb78f68 100644 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/EvaluatedData.cs +++ b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/EvaluatedData.cs @@ -11,17 +11,14 @@ public class EvaluatedData { public EvaluatedData([NotNull] IDBSession session, [NotNull] TBLLContext context) { - if (session == null) throw new ArgumentNullException(nameof(session)); - if (context == null) throw new ArgumentNullException(nameof(context)); - - this.Session = session; - this.Context = context; + this.Session = session ?? throw new ArgumentNullException(nameof(session)); + this.Context = context ?? throw new ArgumentNullException(nameof(context)); } - public IDBSession Session { get; private set; } + public IDBSession Session { get; } - public TBLLContext Context { get; private set; } + public TBLLContext Context { get; } } public class EvaluatedData : EvaluatedData @@ -31,12 +28,10 @@ public class EvaluatedData : EvaluatedData// : IDBSessionEvaluator - where TServiceEnvironment : class, IServiceEnvironment - { - TServiceEnvironment ServiceEnvironment { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/IServiceEnvironment.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/IServiceEnvironment.cs deleted file mode 100644 index 9d437e145..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/IServiceEnvironment.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -using Framework.DomainDriven.BLL; - -namespace Framework.DomainDriven.ServiceModel.Service -{ - public interface IServiceEnvironment : IDBSessionFactoryContainer - { - bool IsDebugMode { get; } - } - - public interface IServiceEnvironment : IServiceEnvironment - { - IContextEvaluator GetContextEvaluator(IServiceProvider currentScopedServiceProvider = null); - - IBLLContextContainer GetBLLContextContainer(IServiceProvider serviceProvider, IDBSession session, string currentPrincipalName = null); - } -} diff --git a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/ServiceEnvironmentFactory.cs b/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/ServiceEnvironmentFactory.cs deleted file mode 100644 index ddd662bfd..000000000 --- a/src/_DomainDriven/Framework.DomainDriven.ServiceModel/Service/ServiceEnvironmentFactory.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; -using Framework.Core; - -namespace Framework.DomainDriven.ServiceModel.Service -{ - internal static class ServiceEnvironmentInitializeHelper - { - public static readonly object ConfigFactoryInstance = Activator.CreateInstance(Type.GetType(Properties.Settings.Default.ServiceEnvironmentFactoryType)); - } - - - internal static class ServiceEnvironmentInitializeHelper - where TServiceEnvironment : IServiceEnvironment - { - public static readonly TServiceEnvironment ConfigServiceEnvironment = ((IFactory)ServiceEnvironmentInitializeHelper.ConfigFactoryInstance).Create(); - } - - public abstract class ServiceEnvironmentFactory : IFactory - where TServiceEnvironment : IServiceEnvironment - { - private static readonly Lazy LazyConfigurationEnvironment = LazyHelper.Create(() => - { - var factory = ServiceEnvironmentInitializeHelper.ConfigFactoryInstance.FromMaybe(() => - $"Factory for type {typeof(TServiceEnvironment).Name} not found"); - - if (!typeof(IFactory).IsAccessableFrom(factory.GetType())) - { - throw new Exception($"Type {factory.GetType().Name} is not factory for {typeof(TServiceEnvironment).Name}"); - } - - - var serviceEnvironmentFactoryType = factory.GetType().GetInterfaces().Single(t => t.IsGenericTypeImplementation(typeof(IFactory<>)) && typeof(TServiceEnvironment).IsAccessableFrom(t.GetGenericArguments())); - - var serviceEnvironmentType = serviceEnvironmentFactoryType.GetGenericArguments().Single(); - - var createMethod = new Func(CreateConfigEnvironmentWithInitialize).Method.GetGenericMethodDefinition().MakeGenericMethod(serviceEnvironmentType); - - return (TServiceEnvironment)createMethod.Invoke(null, new object[] { }); - }); - - - private static TNestedServiceEnvironment CreateConfigEnvironmentWithInitialize() - where TNestedServiceEnvironment : TServiceEnvironment - { - return ServiceEnvironmentInitializeHelper.ConfigServiceEnvironment; - } - - - protected ServiceEnvironmentFactory() - { - - } - - - protected abstract TServiceEnvironment Create(); - - - TServiceEnvironment IFactory.Create() - { - return this.Create(); - } - - public static TServiceEnvironment ConfigurationEnvironment => LazyConfigurationEnvironment.Value; - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.DomainDriven.Tests.Unit/Framework.DomainDriven.Tests.Unit.csproj b/src/_DomainDriven/Framework.DomainDriven.Tests.Unit/Framework.DomainDriven.Tests.Unit.csproj index 336152419..ea2a18598 100644 --- a/src/_DomainDriven/Framework.DomainDriven.Tests.Unit/Framework.DomainDriven.Tests.Unit.csproj +++ b/src/_DomainDriven/Framework.DomainDriven.Tests.Unit/Framework.DomainDriven.Tests.Unit.csproj @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/src/_DomainDriven/Framework.Events/DependencyDetailEventDALListener.cs b/src/_DomainDriven/Framework.Events/DependencyDetailEventDALListener.cs index e69ed4ba5..4c0754d10 100644 --- a/src/_DomainDriven/Framework.Events/DependencyDetailEventDALListener.cs +++ b/src/_DomainDriven/Framework.Events/DependencyDetailEventDALListener.cs @@ -11,12 +11,12 @@ public abstract class DependencyDetailEventDALListener dependencies; + private readonly TypeEventDependency[] dependencies; - protected DependencyDetailEventDALListener(TBLLContext context, IList typeEvents, IMessageSender> messageSender, IList dependencies) - : base(context, typeEvents, messageSender) + protected DependencyDetailEventDALListener(TBLLContext context, IMessageSender> messageSender, IEnumerable typeEvents, IEnumerable dependencies) + : base(context, messageSender, typeEvents) { - this.dependencies = dependencies ?? throw new ArgumentNullException(nameof(dependencies)); + this.dependencies = (dependencies ?? throw new ArgumentNullException(nameof(dependencies))).ToArray(); } protected override IEnumerable> ProcessFinalAllFilteredOrderedValues( diff --git a/src/_DomainDriven/Framework.Events/EventDALListener.cs b/src/_DomainDriven/Framework.Events/EventDALListener.cs index 5c650c889..93f0aeaa7 100644 --- a/src/_DomainDriven/Framework.Events/EventDALListener.cs +++ b/src/_DomainDriven/Framework.Events/EventDALListener.cs @@ -12,20 +12,20 @@ namespace Framework.Events /// /// /// - public abstract class EventDALListener : BLLContextContainer, IManualEventDALListener + public abstract class EventDALListener : BLLContextContainer, IManualEventDALListener, IBeforeTransactionCompletedDALListener where TBLLContext : class where TPersistentDomainObjectBase : class { - private readonly IList typeEvents; + private readonly TypeEvent[] typeEvents; private readonly IMessageSender> messageSender; - protected EventDALListener(TBLLContext context, IList typeEvents, IMessageSender> messageSender) + protected EventDALListener(TBLLContext context, IMessageSender> messageSender, IEnumerable typeEvents) : base(context) { - this.typeEvents = typeEvents; - this.messageSender = messageSender; + + this.typeEvents = (typeEvents ?? throw new ArgumentNullException(nameof(typeEvents))).ToArray(); } Type IPersistentDomainObjectBaseTypeContainer.PersistentDomainObjectBaseType => typeof(TPersistentDomainObjectBase); @@ -76,7 +76,7 @@ public void Process(DALChangesEventArgs eventArgs) CustomDomainObjectType = domainObjectType }; - this.messageSender.Send(message, TransactionMessageMode.DTSTransaction); + this.messageSender.Send(message); } } @@ -87,12 +87,12 @@ protected virtual IEnumerable> ProcessFi return allFilteredOrderedValues; } - IForceEventContainer IManualEventDALListener.GetForceEventContainer() + IOperationEventSender IManualEventDALListener.GetForceEventContainer() { return new ForceEventContainer(this); } - private class ForceEventContainer : IForceEventContainer + private class ForceEventContainer : IOperationEventSender where TDomainObject : class, TPersistentDomainObjectBase { private readonly EventDALListener dalListener; @@ -102,11 +102,11 @@ public ForceEventContainer(EventDALListener eventArgs) { - if (domainObject == null) throw new ArgumentNullException(nameof(domainObject)); + if (eventArgs == null) throw new ArgumentNullException(nameof(eventArgs)); - this.dalListener.Process(new DALChangesEventArgs(GetDALChanges(domainObject, operation))); + this.dalListener.Process(new DALChangesEventArgs(GetDALChanges(eventArgs.DomainObject, eventArgs.Operation))); } private static DALChanges GetDALChanges(TDomainObject domainObject, EventOperation operation) diff --git a/src/_DomainDriven/Framework.Events/EventDTOMessageSender.cs b/src/_DomainDriven/Framework.Events/EventDTOMessageSender.cs index c72598aa8..30cdcc967 100644 --- a/src/_DomainDriven/Framework.Events/EventDTOMessageSender.cs +++ b/src/_DomainDriven/Framework.Events/EventDTOMessageSender.cs @@ -24,9 +24,9 @@ protected EventDTOMessageSender(TBLLContext context, [NotNull] IMessageSender(IDomainOperationSerializeData domainObjectEventArgs, TransactionMessageMode sendMessageMode) + public override void Send(IDomainOperationSerializeData domainObjectEventArgs) { - this.messageSender.Send(this.ToEventDTOBase(domainObjectEventArgs), sendMessageMode); + this.messageSender.Send(this.ToEventDTOBase(domainObjectEventArgs)); } } } diff --git a/src/_DomainDriven/Framework.Events/EventDTOMessageSenderBase.cs b/src/_DomainDriven/Framework.Events/EventDTOMessageSenderBase.cs index 8bac9e196..6f441b7df 100644 --- a/src/_DomainDriven/Framework.Events/EventDTOMessageSenderBase.cs +++ b/src/_DomainDriven/Framework.Events/EventDTOMessageSenderBase.cs @@ -22,7 +22,7 @@ protected EventDTOMessageSenderBase(TBLLContext context) { } - public abstract void Send(IDomainOperationSerializeData domainObjectEventArgs, TransactionMessageMode sendMessageMode) + public abstract void Send(IDomainOperationSerializeData domainObjectEventArgs) where TDomainObject : class, TPersistentDomainObjectBase where TOperation : struct, Enum; @@ -33,21 +33,20 @@ protected abstract TEventDTOBase ToEventDTOBase(IDoma private void InternalSend( TDomainObject domainObject, TOperation operation, - object customSendObject, - TransactionMessageMode sendMessageMode) + object customSendObject) where TDomainObject : class, TPersistentDomainObjectBase where TOperation : struct, Enum { - this.Send(new DomainOperationSerializeData { DomainObject = domainObject, Operation = operation, CustomSendObject = customSendObject}, sendMessageMode); + this.Send(new DomainOperationSerializeData { DomainObject = domainObject, Operation = operation, CustomSendObject = customSendObject}); } - void IMessageSender>.Send([NotNull] IDomainOperationSerializeData domainObjectEventArgs, TransactionMessageMode sendMessageMode) + void IMessageSender>.Send([NotNull] IDomainOperationSerializeData domainObjectEventArgs) { if (domainObjectEventArgs == null) throw new ArgumentNullException(nameof(domainObjectEventArgs)); - var func = new Action(this.InternalSend).CreateGenericMethod(domainObjectEventArgs.DomainObjectType, domainObjectEventArgs.Operation.GetType()); + var func = new Action(this.InternalSend).CreateGenericMethod(domainObjectEventArgs.DomainObjectType, domainObjectEventArgs.Operation.GetType()); - func.Invoke(this, new object[] { domainObjectEventArgs.DomainObject, domainObjectEventArgs.Operation, domainObjectEventArgs.CustomSendObject, sendMessageMode }); + func.Invoke(this, new object[] { domainObjectEventArgs.DomainObject, domainObjectEventArgs.Operation, domainObjectEventArgs.CustomSendObject }); } } } diff --git a/src/_DomainDriven/Framework.Events/EventsSubscriptionManagerBase.cs b/src/_DomainDriven/Framework.Events/EventsSubscriptionManagerBase.cs index 5e57f3957..645256112 100644 --- a/src/_DomainDriven/Framework.Events/EventsSubscriptionManagerBase.cs +++ b/src/_DomainDriven/Framework.Events/EventsSubscriptionManagerBase.cs @@ -1,25 +1,32 @@ using System; +using System.Collections.Generic; using Framework.Core; using Framework.DomainDriven.BLL; +using Framework.Events; using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; + namespace Framework.Events { /// /// Класс для описания правил подписок на доменные евенты /// - /// /// - public abstract class EventsSubscriptionManagerBase : BLLContextContainer, IEventsSubscriptionManager + public abstract class EventsSubscriptionManagerBase : IOperationEventListener where TPersistentDomainObjectBase : class - where TBLLContext : class, IBLLOperationEventContext { - protected EventsSubscriptionManagerBase(TBLLContext context, [NotNull] IMessageSender> messageSender) - : base(context) + private readonly IServiceCollection sc = new ServiceCollection(); + + private readonly Lazy cache; + + protected EventsSubscriptionManagerBase([NotNull] IMessageSender> messageSender) { this.MessageSender = messageSender ?? throw new ArgumentNullException(nameof(messageSender)); + + this.cache = new Lazy(this.BuildCache); } protected IMessageSender> MessageSender { get; } @@ -39,29 +46,81 @@ protected void SubscribeForSaveAndRemoveOperation() this.Subscribe(z => true, z => z == BLLBaseOperation.Save || z == BLLBaseOperation.Remove); } - protected void Subscribe(Func filter, Func operationsFilter) + protected void Subscribe(Func domainObjectFilter, Func operationFilter) where TDomainObject : class, TPersistentDomainObjectBase { - this.Subscribe(filter, operationsFilter); + this.Subscribe(domainObjectFilter, operationFilter); } - protected void Subscribe(Func filter, Func operationsFilter) + protected void Subscribe( + Func domainObjectFilter, + Func operationFilter) where TDomainObject : class, TPersistentDomainObjectBase where TOperation : struct, Enum { - this.Context.OperationListeners.GetEventListener().OperationProcessed += (_, eventArgs) => + var listener = new Listener() + { + Filter = (domainObject, operation) => domainObjectFilter(domainObject) && operationFilter(operation), + CreateMessage = (domainObject, operation) => new DomainOperationSerializeData + { + DomainObject = domainObject, + Operation = operation + } + }; + + this.sc.AddSingleton(listener); + } + + protected void SubscribeCustom( + Func domainObjectFilter, + Func operationFilter, + Func convertFunc) + where TDomainObject : class, TPersistentDomainObjectBase + where TOperation : struct, Enum + { + var listener = new Listener() + { + Filter = (domainObject, operation) => domainObjectFilter(domainObject) && operationFilter(operation), + CreateMessage = (domainObject, operation) => new DomainOperationSerializeData + { + DomainObject = domainObject, + Operation = operation, + CustomSendObject = convertFunc(domainObject) + } + }; + + this.sc.AddSingleton(listener); + } + + private IServiceProvider BuildCache() + { + this.Subscribe(); + + return this.sc.BuildServiceProvider(); + } + + public virtual void OnFired(IDomainOperationEventArgs eventArgs) + where TDomainObject : class, TPersistentDomainObjectBase + where TOperation : struct, Enum + { + this.cache.Value.GetRequiredService>>().Foreach(listener => { - if (filter(eventArgs.DomainObject) && operationsFilter(eventArgs.Operation)) + if (listener.Filter(eventArgs.DomainObject, eventArgs.Operation)) { - var message = new DomainOperationSerializeData - { - DomainObject = eventArgs.DomainObject, - Operation = eventArgs.Operation - }; + var message = listener.CreateMessage(eventArgs.DomainObject, eventArgs.Operation); this.MessageSender.Send(message); } - }; + }); + } + + private class Listener + where TDomainObject : class + where TOperation : struct, Enum + { + public Func Filter { get; set; } + + public Func> CreateMessage { get; set; } } } } diff --git a/src/_DomainDriven/Framework.Events/Framework.Events.csproj b/src/_DomainDriven/Framework.Events/Framework.Events.csproj index 125b14785..934b9249a 100644 --- a/src/_DomainDriven/Framework.Events/Framework.Events.csproj +++ b/src/_DomainDriven/Framework.Events/Framework.Events.csproj @@ -6,6 +6,10 @@ + + + + diff --git a/src/_DomainDriven/Framework.Events/IDomainOperationSerializeData.cs b/src/_DomainDriven/Framework.Events/IDomainOperationSerializeData.cs index ce18cd08e..c5560f5fa 100644 --- a/src/_DomainDriven/Framework.Events/IDomainOperationSerializeData.cs +++ b/src/_DomainDriven/Framework.Events/IDomainOperationSerializeData.cs @@ -16,12 +16,14 @@ public interface IDomainOperationSerializeData public interface IDomainOperationSerializeData : IDomainOperationSerializeData where TDomainObject : class + where TOperation : struct, Enum { new TOperation Operation { get; } } public struct DomainOperationSerializeData : IDomainOperationSerializeData where TDomainObject : class + where TOperation: struct, Enum { public TDomainObject DomainObject { get; set; } @@ -33,6 +35,6 @@ public struct DomainOperationSerializeData : IDomainO Type IDomainOperationSerializeData.DomainObjectType => this.CustomDomainObjectType ?? typeof(TDomainObject); - Enum IDomainOperationSerializeData.Operation => (Enum)(object)this.Operation; + Enum IDomainOperationSerializeData.Operation => this.Operation; } } diff --git a/src/_DomainDriven/Framework.Events/IEventsSubscriptionManager.cs b/src/_DomainDriven/Framework.Events/IEventsSubscriptionManager.cs deleted file mode 100644 index 77adfe150..000000000 --- a/src/_DomainDriven/Framework.Events/IEventsSubscriptionManager.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Framework.DomainDriven.BLL; - -namespace Framework.Events -{ - /// - /// Интерфейс для описания правил подписок на доменные евенты - /// - /// - /// - public interface IEventsSubscriptionManager : IBLLContextContainer - where TPersistentDomainObjectBase : class - where TBLLContext : class, IBLLOperationEventContext - { - /// - /// Подписка на события - /// - void Subscribe(); - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.Events/IManualEventDALListener.cs b/src/_DomainDriven/Framework.Events/IManualEventDALListener.cs index fbb74004d..20c245e27 100644 --- a/src/_DomainDriven/Framework.Events/IManualEventDALListener.cs +++ b/src/_DomainDriven/Framework.Events/IManualEventDALListener.cs @@ -12,7 +12,7 @@ public interface IManualEventDALListener : IDALL /// /// /// - IForceEventContainer GetForceEventContainer() + IOperationEventSender GetForceEventContainer() where TDomainObject : class, TPersistentDomainObjectBase; } } diff --git a/src/_DomainDriven/Framework.Notification/IExceptionSenderContainer.cs b/src/_DomainDriven/Framework.Notification/IExceptionSenderContainer.cs deleted file mode 100644 index 30d123314..000000000 --- a/src/_DomainDriven/Framework.Notification/IExceptionSenderContainer.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using Framework.Core; - -namespace Framework.Notification -{ - public interface IExceptionSenderContainer - { - IMessageSender ExceptionSender { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.Notification/INotificationService.cs b/src/_DomainDriven/Framework.Notification/INotificationService.cs deleted file mode 100644 index 4037f5e34..000000000 --- a/src/_DomainDriven/Framework.Notification/INotificationService.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using Framework.Core; - -namespace Framework.Notification -{ - public interface INotificationService : IExceptionSenderContainer - { - IMessageSender MainSender { get; } - - IMessageSender NotificationSender { get; } - - IMessageSender SubscriptionSender { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.Notification/INotificationServiceContainer.cs b/src/_DomainDriven/Framework.Notification/INotificationServiceContainer.cs deleted file mode 100644 index 185b56750..000000000 --- a/src/_DomainDriven/Framework.Notification/INotificationServiceContainer.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Framework.Notification -{ - public interface INotificationServiceContainer - //where TNotificationService : INotificationService - { - TNotificationService NotificationService { get; } - } -} \ No newline at end of file diff --git a/src/_DomainDriven/Framework.Notification/MessageTemplateNotificationSenderExtensions.cs b/src/_DomainDriven/Framework.Notification/MessageTemplateNotificationSenderExtensions.cs index 9eb6d26a9..277bb5a83 100644 --- a/src/_DomainDriven/Framework.Notification/MessageTemplateNotificationSenderExtensions.cs +++ b/src/_DomainDriven/Framework.Notification/MessageTemplateNotificationSenderExtensions.cs @@ -10,28 +10,27 @@ namespace Framework.Notification { public static class MessageTemplateNotificationSenderExtensions { - public static void Send(this IMessageSender sender, TransactionMessageMode sendMessageMode, string messageTemplateCode, T contextObject, IEnumerable receivers, ISubscription subscription = null) + public static void Send(this IMessageSender sender, string messageTemplateCode, T contextObject, IEnumerable receivers, ISubscription subscription = null) { if (sender == null) throw new ArgumentNullException(nameof(sender)); if (messageTemplateCode == null) throw new ArgumentNullException(nameof(messageTemplateCode)); if (contextObject == null) throw new ArgumentNullException(nameof(contextObject)); if (receivers == null) throw new ArgumentNullException(nameof(receivers)); - sender.Send(new MessageTemplateNotification(messageTemplateCode, contextObject, typeof(T), receivers, Enumerable.Empty(), subscription), sendMessageMode); + sender.Send(new MessageTemplateNotification(messageTemplateCode, contextObject, typeof(T), receivers, Enumerable.Empty(), subscription)); } /// /// Creates and sends e-mail message according to input params /// /// Notification message sender - /// /// E-mail subject /// E-mail body /// A list of recipients /// A list of attachments /// E-mail sender /// Message Template Code (if not specified default value is 'auto-generated') - public static void Send(this IMessageSender sender, TransactionMessageMode sendMessageMode, string subject, string body, IEnumerable recipients, IEnumerable attachments, string from = null, string messageTemplateCode = "auto-generated") + public static void Send(this IMessageSender sender, string subject, string body, IEnumerable recipients, IEnumerable attachments, string from = null, string messageTemplateCode = "auto-generated") { if (sender == null) throw new ArgumentNullException(nameof(sender)); if (subject == null) throw new ArgumentNullException(nameof(subject)); @@ -39,7 +38,7 @@ public static void Send(this IMessageSender sender, TransactionMes var notification = GetNotification(subject, body, recipients, attachments, from, messageTemplateCode); - sender.Send(notification, sendMessageMode); + sender.Send(notification); } private static Notification GetNotification(string subject, string body, IEnumerable recipients, IEnumerable attachments, string sender, string messageTemplateCode) diff --git a/src/_DomainDriven/Framework.Notification/New/Senders/SmtpMessageSender.cs b/src/_DomainDriven/Framework.Notification/New/Senders/SmtpMessageSender.cs index 62a93a06a..50e72129b 100644 --- a/src/_DomainDriven/Framework.Notification/New/Senders/SmtpMessageSender.cs +++ b/src/_DomainDriven/Framework.Notification/New/Senders/SmtpMessageSender.cs @@ -45,7 +45,7 @@ public SmtpMessageSender(Func getSmtpClient) } /// - public void Send(Message message, TransactionMessageMode transactionMessageMode) + public void Send(Message message) { if (message == null) { diff --git a/src/_DomainDriven/Framework.Notification/NotificationService.cs b/src/_DomainDriven/Framework.Notification/NotificationService.cs deleted file mode 100644 index 4a73f2566..000000000 --- a/src/_DomainDriven/Framework.Notification/NotificationService.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using Framework.Core; - -namespace Framework.Notification -{ - /// - /// Notification service - /// - public class NotificationService : INotificationService - { - public NotificationService(IMessageSender mainSender, IMessageSender notificationSender, IMessageSender subscriptionSender, IMessageSender exceptionSender) - { - if (mainSender == null) throw new ArgumentNullException(nameof(mainSender)); - if (subscriptionSender == null) throw new ArgumentNullException(nameof(subscriptionSender)); - if (exceptionSender == null) throw new ArgumentNullException(nameof(exceptionSender)); - - this.MainSender = mainSender; - this.NotificationSender = notificationSender; - this.SubscriptionSender = subscriptionSender; - this.ExceptionSender = exceptionSender; - } - - /// - /// Template message sender - /// - public IMessageSender MainSender { get; private set; } - - /// - /// Subscription message sender - /// - public IMessageSender SubscriptionSender { get; private set; } - - /// - /// Notification message sender - /// - public IMessageSender NotificationSender { get; private set; } - - /// - /// Exception message sender - /// - public IMessageSender ExceptionSender { get; private set; } - } -} \ No newline at end of file diff --git a/src/_Report/Framework.CustomReports.Tests.Unit/CustomReportBLLBaseTests.cs b/src/_Report/Framework.CustomReports.Tests.Unit/CustomReportBLLBaseTests.cs index 5de61f3a3..8a19e436f 100644 --- a/src/_Report/Framework.CustomReports.Tests.Unit/CustomReportBLLBaseTests.cs +++ b/src/_Report/Framework.CustomReports.Tests.Unit/CustomReportBLLBaseTests.cs @@ -30,21 +30,6 @@ public void ConvertToTypedValue_GuidString_TypedResult() typedValue.ToString().Should().Be(GuidString); } - [Test] - public void ConvertToTypedValue_EnumString_TypedResult() - { - // Arrange - const string EnumString = "InternalTransaction"; - var bll = new TestingCustomReportBll(null); - - // Act - var typedValue = bll.ConvertToTypedValue(EnumString, typeof(TransactionMessageMode)); - - // Assert - typedValue.Should().BeOfType(); - typedValue.ToString().Should().Be(EnumString); - } - private class TestingCustomReportBll : CustomReportBLLBase { public TestingCustomReportBll(IConfigurationBLLContext context) diff --git a/src/_Report/Framework.CustomReports.Tests.Unit/Framework.CustomReports.Tests.Unit.csproj b/src/_Report/Framework.CustomReports.Tests.Unit/Framework.CustomReports.Tests.Unit.csproj index 021dc9caf..da1b26c03 100644 --- a/src/_Report/Framework.CustomReports.Tests.Unit/Framework.CustomReports.Tests.Unit.csproj +++ b/src/_Report/Framework.CustomReports.Tests.Unit/Framework.CustomReports.Tests.Unit.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/src/_Report/Framework.CustomReports.WebApi/ISyncCustomReportService.cs b/src/_Report/Framework.CustomReports.WebApi/ISyncCustomReportService.cs index c6b66f58e..4f3b2634a 100644 --- a/src/_Report/Framework.CustomReports.WebApi/ISyncCustomReportService.cs +++ b/src/_Report/Framework.CustomReports.WebApi/ISyncCustomReportService.cs @@ -1,13 +1,12 @@ using System.Collections.Generic; using Framework.CustomReports.Domain; using Framework.DomainDriven.BLL.Configuration; -using Framework.DomainDriven.ServiceModel.Service; namespace Framework.CustomReports.WebApi { public interface ISyncCustomReportService where TBLLContext : IConfigurationBLLContextContainer { - void Sync(IServiceEnvironment serviceEnvironment, IList> runtimeReports); + void Sync(IList> runtimeReports); } } diff --git a/src/_Report/Framework.CustomReports.WebApi/Impl/GenericReportControllerBase.cs b/src/_Report/Framework.CustomReports.WebApi/Impl/GenericReportControllerBase.cs index a54ee0f78..7c512a681 100644 --- a/src/_Report/Framework.CustomReports.WebApi/Impl/GenericReportControllerBase.cs +++ b/src/_Report/Framework.CustomReports.WebApi/Impl/GenericReportControllerBase.cs @@ -32,8 +32,7 @@ namespace Framework.CustomReports.WebApi { - public abstract class GenericReportControllerBase : ApiControllerBase> - where TServiceEnvironment : class, IServiceEnvironment, ISystemMetadataTypeBuilderContainer, IReportServiceContainer, ISecurityOperationCodeProviderContainer + public abstract class GenericReportControllerBase : ApiControllerBase> where TBLLContext : class, @@ -55,12 +54,28 @@ public abstract class GenericReportControllerBase reportParameterValueService; + + private readonly IReportService reportService; + + private readonly ISecurityOperationCodeProvider securityOperationCodeProvider; + private Lazy> typeMetadataDictLazy; - protected GenericReportControllerBase(TServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + protected GenericReportControllerBase( + ISystemMetadataTypeBuilder systemMetadataTypeBuilder, + IReportParameterValueService reportParameterValueService, + IReportService reportService, + ISecurityOperationCodeProvider securityOperationCodeProvider) { + this.systemMetadataTypeBuilder = systemMetadataTypeBuilder; + this.reportParameterValueService = reportParameterValueService; + this.reportService = reportService; + this.securityOperationCodeProvider = securityOperationCodeProvider; + this.InitDict(); } @@ -150,7 +165,7 @@ public ReportGenerationRequestModelRichDTO GetRichReportGenerationRequestModel([ return new ReportGenerationRequestModelRichDTO() { Parameters = parameters, TypeMetadatas = typeMetadatas }; }); } - + [HttpPost(nameof(GetSimpleReportParameterValues))] public SelectOperationResult GetSimpleReportParameterValues(GetSimpleReportParameterValuesRequest request) { @@ -166,7 +181,7 @@ public SelectOperationResult GetSimpleReportParam var reportServiceContext = this.GetReportServiceContext(evaludatedData.Context); - var result = this.ServiceEnvironment.ReportParameterValueService.GetParameterValuesBy(reportServiceContext, parameter, selectOperation); + var result = this.reportParameterValueService.GetParameterValuesBy(reportServiceContext, parameter, selectOperation); return new SelectOperationResult(result.Items.ToSimpleDTOList(this.GetConfigurationMappingService(evaludatedData)), result.TotalCount); }); @@ -183,7 +198,7 @@ public SelectOperationResult GetSimpleReportParam var reportServiceContext = this.GetReportServiceContext(evaludatedData.Context); - var result = this.ServiceEnvironment.ReportParameterValueService.GetParameterValuesBy(reportServiceContext, request.typeName, selectOperation); + var result = this.reportParameterValueService.GetParameterValuesBy(reportServiceContext, request.typeName, selectOperation); return new SelectOperationResult(result.Items.ToSimpleDTOList(this.GetConfigurationMappingService(evaludatedData)), result.TotalCount); }); @@ -214,12 +229,12 @@ public IList GetReportParameterValuePositions(IEnumerable GetReportParameterValuePositionsByTypeName(GetReportPara var reportServiceContext = this.GetReportServiceContext(evaludatedData.Context); - var parameterValues = this.ServiceEnvironment.ReportParameterValueService.GetParameterValuesBy(reportServiceContext, request.typeName, selectOperation); + var parameterValues = this.reportParameterValueService.GetParameterValuesBy(reportServiceContext, request.typeName, selectOperation); var values = parameterValues.Items.Select((item, index) => new { Id = Guid.Parse(item.Value), Index = index }); @@ -332,7 +347,7 @@ public virtual FileStreamResult GetStream(ReportGenerationModelStrictDTO modelDT model.PredefineGenerationValues = this.GetPredefineFilterParameters(model, reportServiceContext); - var reportStream = this.ServiceEnvironment.ReportService.GetReportStream(model, reportServiceContext); + var reportStream = this.reportService.GetReportStream(model, reportServiceContext); return this.GetReportResult(reportStream); }); @@ -341,7 +356,7 @@ public virtual FileStreamResult GetStream(ReportGenerationModelStrictDTO modelDT [HttpPost(nameof(GetTypeMetadatas))] public IEnumerable GetTypeMetadatas() { - return this.ServiceEnvironment.SystemMetadataTypeBuilder.SystemMetadata.Types; + return this.systemMetadataTypeBuilder.SystemMetadata.Types; } @@ -349,7 +364,7 @@ protected virtual IEnumerable GetPredefineFilter { if (model.Report.Filters.Any(z => !z.IsValueFromParameters)) { - var reportDomainType = this.ServiceEnvironment.SystemMetadataTypeBuilder.TypeResolver.Resolve(new TypeHeader(model.Report.DomainTypeName)); + var reportDomainType = this.systemMetadataTypeBuilder.TypeResolver.Resolve(new TypeHeader(model.Report.DomainTypeName)); foreach (var item in model.Report.Filters.Where(z => !z.IsValueFromParameters)) { @@ -366,7 +381,7 @@ protected virtual IEnumerable GetPredefineFilter throw new BusinessLogicException($"Expected Guid in filter:{item.Property}"); } - yield return new ReportGenerationPredefineValue(propertyDomainType.Type.Name, this.ServiceEnvironment.ReportParameterValueService.GetDesignValue(reportServiceContext, expectedId, propertyTypeHeader)); + yield return new ReportGenerationPredefineValue(propertyDomainType.Type.Name, this.reportParameterValueService.GetDesignValue(reportServiceContext, expectedId, propertyTypeHeader)); } else { @@ -410,15 +425,15 @@ private void InitDict() { this.typeMetadataDictLazy = new Lazy>(() => this.GetTypeMetadataDict(), true); } - + private ReportServiceContext GetReportServiceContext(TBLLContext context) { - return new ReportServiceContext(context, this.ServiceEnvironment.SystemMetadataTypeBuilder, this.ServiceEnvironment.SecurityOperationCodeProvider); + return new ReportServiceContext(context, this.systemMetadataTypeBuilder, this.securityOperationCodeProvider); } private Dictionary GetTypeMetadataDict() { - return this.ServiceEnvironment.SystemMetadataTypeBuilder.SystemMetadata.Types.ToDictionary(z => z.Type.Name, z => z); + return this.systemMetadataTypeBuilder.SystemMetadata.Types.ToDictionary(z => z.Type.Name, z => z); } } } diff --git a/src/_Report/Framework.CustomReports.WebApi/ReportDefinitionServiceEnvironment.cs b/src/_Report/Framework.CustomReports.WebApi/ReportDefinitionServiceEnvironment.cs index 3a13efe6d..a578fee67 100644 --- a/src/_Report/Framework.CustomReports.WebApi/ReportDefinitionServiceEnvironment.cs +++ b/src/_Report/Framework.CustomReports.WebApi/ReportDefinitionServiceEnvironment.cs @@ -18,24 +18,24 @@ namespace Framework.CustomReports.WebApi { - public abstract class ReportDefinitionServiceEnvironment - - : IReportServiceContainer, - IServiceEnvironment, - ISystemMetadataTypeBuilderContainer - - where TBLLContext : IConfigurationBLLContextContainer, IAuthorizationBLLContextContainer, - IBLLFactoryContainerContext>>, - ISecurityServiceContainer>, - IFetchServiceContainer, IValidatorContainer, ISecurityOperationResolver where TServiceEnvironment : class, IServiceEnvironment, ISystemMetadataTypeBuilderContainer - where TPersistentDomainObjectBase : class, IIdentityObject - where TSecurityOperationCode : struct, Enum + public abstract class ReportDefinitionServiceEnvironment + + where TBLLContext : IConfigurationBLLContextContainer, IAuthorizationBLLContextContainer, + IBLLFactoryContainerContext>>, + ISecurityServiceContainer>, + IFetchServiceContainer, IValidatorContainer, ISecurityOperationResolver + + where TPersistentDomainObjectBase : class, IIdentityObject + where TSecurityOperationCode : struct, Enum { - private readonly TServiceEnvironment _serviceEnvironment; + private readonly ISystemMetadataTypeBuilder systemMetadataTypeBuilder; - protected ReportDefinitionServiceEnvironment(TServiceEnvironment serviceEnvironment, CustomReportAssembly customReportAssembly) + private readonly IContextEvaluator contextEvaluator; + + protected ReportDefinitionServiceEnvironment(ISystemMetadataTypeBuilder systemMetadataTypeBuilder, IContextEvaluator contextEvaluator, CustomReportAssembly customReportAssembly) { - this._serviceEnvironment = serviceEnvironment; + this.systemMetadataTypeBuilder = systemMetadataTypeBuilder; + this.contextEvaluator = contextEvaluator; var links = new CustomReportParameterLinkService(customReportAssembly).GetLinks(); @@ -70,44 +70,19 @@ protected ReportDefinitionServiceEnvironment(TServiceEnvironment serviceEnvironm z => this.GetCreateCustomReportBLL(parameterTypeToCustomReportBLL[z.Reports.First().ParameterType])); - this.GetSyncCustomReportService().Sync(this, customReports); + this.GetSyncCustomReportService().Sync(customReports); this.ReportService = new ReportService(idToCreateCustomReportDict); - this.ReportParameterValueService = new ReportParameterValueService(); - } protected virtual ISyncCustomReportService GetSyncCustomReportService() { - return new SyncCustomReportService(this.SystemMetadataTypeBuilder); - } - - public TServiceEnvironment ServiceEnvironment => this._serviceEnvironment; - - public virtual IReportService ReportService - { - get; - private set; + return new SyncCustomReportService(this.systemMetadataTypeBuilder, this.contextEvaluator); } - public virtual IReportParameterValueService ReportParameterValueService - { get; private set; } - - - public IContextEvaluator GetContextEvaluator(IServiceProvider currentScopedServiceProvider = null) => this.ServiceEnvironment.GetContextEvaluator(currentScopedServiceProvider); - - public IBLLContextContainer GetBLLContextContainer(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName = null) - { - return this.ServiceEnvironment.GetBLLContextContainer(scopedServiceProvider, session, currentPrincipalName); - } - - public IDBSessionFactory SessionFactory => this.ServiceEnvironment.SessionFactory; - - public bool IsDebugMode => this.ServiceEnvironment.IsDebugMode; - - public ISystemMetadataTypeBuilder SystemMetadataTypeBuilder => this.ServiceEnvironment.SystemMetadataTypeBuilder; + public virtual IReportService ReportService { get; } protected virtual Func GetCreateCustomReportBLL(Type customReportType) { @@ -123,9 +98,9 @@ protected virtual Func GetCreateCustomRepor var newExpression = Expression.New(targetConstructor, parameter); - var resultExpresssion = Expression.Lambda>(newExpression, parameter); + var resultExpression = Expression.Lambda>(newExpression, parameter); - var resultFunc = resultExpresssion.Compile(); + var resultFunc = resultExpression.Compile(); return resultFunc; } diff --git a/src/_Report/Framework.CustomReports.WebApi/SyncCustomReportService.cs b/src/_Report/Framework.CustomReports.WebApi/SyncCustomReportService.cs index 3eea7bdb6..965d50348 100644 --- a/src/_Report/Framework.CustomReports.WebApi/SyncCustomReportService.cs +++ b/src/_Report/Framework.CustomReports.WebApi/SyncCustomReportService.cs @@ -12,7 +12,6 @@ using Framework.DomainDriven.BLL.Configuration; using Framework.DomainDriven.BLL.Tracking; using Framework.DomainDriven.SerializeMetadata; -using Framework.DomainDriven.ServiceModel.Service; using Framework.Persistent; using Framework.Transfering; @@ -21,15 +20,19 @@ namespace Framework.CustomReports.WebApi public class SyncCustomReportService : ISyncCustomReportService where TBLLContext : IConfigurationBLLContextContainer { - public SyncCustomReportService(ISystemMetadataTypeBuilder systemMetadataBuilder) + private readonly IContextEvaluator contextEvaluator; + + public SyncCustomReportService(ISystemMetadataTypeBuilder systemMetadataBuilder, IContextEvaluator contextEvaluator) { + this.contextEvaluator = contextEvaluator; this.SystemMetadataBuilder = systemMetadataBuilder; } - public ISystemMetadataTypeBuilder SystemMetadataBuilder { get; private set; } - public void Sync(IServiceEnvironment serviceEnvironment, IList> runtimeReports) + public ISystemMetadataTypeBuilder SystemMetadataBuilder { get; } + + public void Sync(IList> runtimeReports) { - serviceEnvironment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.contextEvaluator.Evaluate(DBSessionMode.Write, context => { var expectedReports = runtimeReports; diff --git a/src/_Report/Framework.CustomReports/Services/IReportServiceContainer.cs b/src/_Report/Framework.CustomReports/Services/IReportServiceContainer.cs deleted file mode 100644 index 05feccbe8..000000000 --- a/src/_Report/Framework.CustomReports/Services/IReportServiceContainer.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -using Framework.Authorization.BLL; -using Framework.CustomReports.Services; -using Framework.DomainDriven; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; -using Framework.Persistent; - -namespace Framework.CustomReports.Domain -{ - public interface IReportServiceContainer - where TBLLContext : - DomainDriven.BLL.Configuration.IConfigurationBLLContextContainer, - IAuthorizationBLLContextContainer, IFetchServiceContainer, IBLLFactoryContainerContext>>, ISecurityServiceContainer> where TPersistentDomainObjectBase : class, IIdentityObject - where TSecurityOperationCode : struct, Enum - { - IReportService ReportService { get; } - - IReportParameterValueService ReportParameterValueService { get; } - } -} \ No newline at end of file diff --git a/src/_Report/Framework.CustomReports/Services/ISecurityOperationCodeProviderContainer.cs b/src/_Report/Framework.CustomReports/Services/ISecurityOperationCodeProviderContainer.cs deleted file mode 100644 index 001eb26c2..000000000 --- a/src/_Report/Framework.CustomReports/Services/ISecurityOperationCodeProviderContainer.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Framework.CustomReports.Domain -{ - public interface ISecurityOperationCodeProviderContainer - { - ISecurityOperationCodeProvider SecurityOperationCodeProvider { get; } - } -} \ No newline at end of file diff --git a/src/_Report/Framework.CustomReports/Services/ReportServiceContext.cs b/src/_Report/Framework.CustomReports/Services/ReportServiceContext.cs index c6c432da3..869e08788 100644 --- a/src/_Report/Framework.CustomReports/Services/ReportServiceContext.cs +++ b/src/_Report/Framework.CustomReports/Services/ReportServiceContext.cs @@ -2,12 +2,12 @@ namespace Framework.CustomReports.Domain { - public class ReportServiceContext : IServiceMetadataContainer, ISystemMetadataTypeBuilderContainer + public class ReportServiceContext : IServiceMetadataContainer { public readonly TBLLContext Context; public SystemMetadata SystemMetadata => this.SystemMetadataTypeBuilder.SystemMetadata; - public ISystemMetadataTypeBuilder SystemMetadataTypeBuilder { get; private set; } + public ISystemMetadataTypeBuilder SystemMetadataTypeBuilder { get; } public readonly ISecurityOperationCodeProvider SecurityOperationCodeProvider; diff --git a/src/_Report/Framework.Report.Tests.Unit/Framework.Report.Tests.Unit.csproj b/src/_Report/Framework.Report.Tests.Unit/Framework.Report.Tests.Unit.csproj index 918032d0d..479ae1113 100644 --- a/src/_Report/Framework.Report.Tests.Unit/Framework.Report.Tests.Unit.csproj +++ b/src/_Report/Framework.Report.Tests.Unit/Framework.Report.Tests.Unit.csproj @@ -3,10 +3,10 @@ false - + - - + + diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/AuthorizationValidatorCompileCache.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/AuthorizationValidatorCompileCache.cs new file mode 100644 index 000000000..f2e8b7777 --- /dev/null +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/AuthorizationValidatorCompileCache.cs @@ -0,0 +1,18 @@ +using System; + +using Framework.Core; +using Framework.Validation; + +using Framework.DomainDriven.BLL; + +namespace SampleSystem.BLL; + +public class SampleSystemValidatorCompileCache : ValidatorCompileCache +{ + public SampleSystemValidatorCompileCache(IAvailableValues availableValues) : + base(availableValues + .ToBLLContextValidationExtendedData() + .Pipe(extendedValidationData => new SampleSystemValidationMap(extendedValidationData))) + { + } +} diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContext.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContext.cs index e2dc80f1c..538dd4bfb 100644 --- a/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContext.cs +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContext.cs @@ -20,16 +20,13 @@ public partial interface ISampleSystemBLLContext : ICryptServiceContainer, - IImpersonateObject, - ITypeResolverContainer, Framework.DomainDriven.BLL.Configuration.IConfigurationBLLContextContainer, IDefaultHierarchicalBLLContext, - IDateTimeServiceContainer + ISecurityTypeResolverContainer { - IDBSession Session { get; } } } diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContextSettings.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContextSettings.cs new file mode 100644 index 000000000..cbb0f6e27 --- /dev/null +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemBLLContextSettings.cs @@ -0,0 +1,7 @@ +using Framework.Core; + +namespace SampleSystem.BLL; + +public interface ISampleSystemBLLContextSettings : ITypeResolverContainer +{ +} diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemValidator.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemValidator.cs new file mode 100644 index 000000000..fdbe0e457 --- /dev/null +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/ISampleSystemValidator.cs @@ -0,0 +1,7 @@ +using Framework.Validation; + +namespace SampleSystem.BLL; + +public interface ISampleSystemValidator : IValidator +{ +} diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContext.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContext.cs index c07a371f9..2f7a507f3 100644 --- a/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContext.cs +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContext.cs @@ -4,14 +4,12 @@ using Framework.Core; using Framework.DomainDriven; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; using Framework.SecuritySystem.Rules.Builders; using Framework.DomainDriven.BLL.Tracking; using Framework.HierarchicalExpand; using Framework.QueryLanguage; using Framework.Security.Cryptography; using Framework.SecuritySystem; -using Framework.Validation; using JetBrains.Annotations; @@ -22,30 +20,25 @@ namespace SampleSystem.BLL { public partial class SampleSystemBLLContext { - private readonly Func _impersonateFunc; - public SampleSystemBLLContext( IServiceProvider serviceProvider, [NotNull] IDALFactory dalFactory, - [NotNull] BLLOperationEventListenerContainer operationListeners, + [NotNull] IOperationEventSenderContainer operationSenders, [NotNull] BLLSourceEventListenerContainer sourceListeners, [NotNull] IObjectStateService objectStateService, [NotNull] IAccessDeniedExceptionService accessDeniedExceptionService, [NotNull] IStandartExpressionBuilder standartExpressionBuilder, - [NotNull] IValidator validator, + [NotNull] ISampleSystemValidator validator, [NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, [NotNull] IFetchService fetchService, - [NotNull] IDateTimeService dateTimeService, [NotNull] ISampleSystemSecurityService securityService, [NotNull] ISecurityExpressionBuilderFactory securityExpressionBuilderFactory, [NotNull] ISampleSystemBLLFactoryContainer logics, [NotNull] IAuthorizationBLLContext authorization, [NotNull] Framework.Configuration.BLL.IConfigurationBLLContext configuration, [NotNull] ICryptService cryptService, - [NotNull] Func impersonateFunc, - [NotNull] ITypeResolver currentTargetSystemTypeResolver, - [NotNull] IDBSession session) - : base(serviceProvider, dalFactory, operationListeners, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService, dateTimeService) + [NotNull] ISampleSystemBLLContextSettings settings) + : base(serviceProvider, dalFactory, operationSenders, sourceListeners, objectStateService, accessDeniedExceptionService, standartExpressionBuilder, validator, hierarchicalObjectExpanderFactory, fetchService) { this.SecurityExpressionBuilderFactory = securityExpressionBuilderFactory ?? throw new ArgumentNullException(nameof(securityExpressionBuilderFactory)); @@ -57,9 +50,7 @@ public SampleSystemBLLContext( this.CryptService = cryptService ?? throw new ArgumentNullException(nameof(cryptService)); - this._impersonateFunc = impersonateFunc ?? throw new ArgumentNullException(nameof(impersonateFunc)); - this.TypeResolver = currentTargetSystemTypeResolver ?? throw new ArgumentNullException(nameof(currentTargetSystemTypeResolver)); - this.Session = session ?? throw new ArgumentNullException(nameof(session)); + this.TypeResolver = settings.TypeResolver; } public ISampleSystemSecurityService SecurityService { get; } @@ -76,17 +67,11 @@ public SampleSystemBLLContext( public ITypeResolver TypeResolver { get; } - [NotNull] - public IDBSession Session { get; } - - public ISampleSystemBLLContext Impersonate(string principalName) - { - return this._impersonateFunc(principalName); - } - public override bool AllowVirtualPropertyInOdata(Type domainType) { return base.AllowVirtualPropertyInOdata(domainType) || domainType == typeof(BusinessUnitProgramClass); } + + ITypeResolver ISecurityTypeResolverContainer.SecurityTypeResolver => this.TypeResolver; } } diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContextSettings.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContextSettings.cs new file mode 100644 index 000000000..cf785552f --- /dev/null +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemBLLContextSettings.cs @@ -0,0 +1,12 @@ +using System; + +using Framework.Core; + +using SampleSystem.Domain; + +namespace SampleSystem.BLL; + +public class SampleSystemBLLContextSettings : ISampleSystemBLLContextSettings +{ + public ITypeResolver TypeResolver { get; init; } = TypeSource.FromSample().ToDefaultTypeResolver(); +} diff --git a/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemValidator.cs b/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemValidator.cs new file mode 100644 index 000000000..7f663b39b --- /dev/null +++ b/src/_SampleSystem/SampleSystem.BLL.Core/Context/SampleSystemValidator.cs @@ -0,0 +1,5 @@ +namespace SampleSystem.BLL; + +public partial class SampleSystemValidator : ISampleSystemValidator +{ +} diff --git a/src/_SampleSystem/SampleSystem.Domain/SampleSystem.Domain.csproj b/src/_SampleSystem/SampleSystem.Domain/SampleSystem.Domain.csproj index fc7c450bc..db5d3051a 100644 --- a/src/_SampleSystem/SampleSystem.Domain/SampleSystem.Domain.csproj +++ b/src/_SampleSystem/SampleSystem.Domain/SampleSystem.Domain.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/_SampleSystem/SampleSystem.Events/SampleSystemAribaEventsSubscriptionManager.cs b/src/_SampleSystem/SampleSystem.Events/SampleSystemAribaEventsSubscriptionManager.cs index b0b05f829..75259c1f7 100644 --- a/src/_SampleSystem/SampleSystem.Events/SampleSystemAribaEventsSubscriptionManager.cs +++ b/src/_SampleSystem/SampleSystem.Events/SampleSystemAribaEventsSubscriptionManager.cs @@ -1,17 +1,15 @@ -using Framework.Core; -using Framework.Events; +using Framework.Events; using JetBrains.Annotations; -using SampleSystem.BLL; using SampleSystem.Domain; namespace SampleSystem.Events { - public class SampleSystemAribaEventsSubscriptionManager : EventsSubscriptionManagerBase + public class SampleSystemAribaEventsSubscriptionManager : EventsSubscriptionManagerBase { - public SampleSystemAribaEventsSubscriptionManager(ISampleSystemBLLContext context, [NotNull] IMessageSender> messageSender) - : base(context, messageSender) + public SampleSystemAribaEventsSubscriptionManager([NotNull] SampleSystemAribaLocalDBEventMessageSender messageSender) + : base(messageSender) { } diff --git a/src/_SampleSystem/SampleSystem.Events/SampleSystemEventsSubscriptionManager.cs b/src/_SampleSystem/SampleSystem.Events/SampleSystemEventsSubscriptionManager.cs index eeb561014..546ee8801 100644 --- a/src/_SampleSystem/SampleSystem.Events/SampleSystemEventsSubscriptionManager.cs +++ b/src/_SampleSystem/SampleSystem.Events/SampleSystemEventsSubscriptionManager.cs @@ -6,20 +6,21 @@ using JetBrains.Annotations; -using SampleSystem.BLL; using SampleSystem.Domain; using SampleSystem.Generated.DTO; namespace SampleSystem.Events { - public class SampleSystemEventsSubscriptionManager : EventsSubscriptionManagerBase + public class SampleSystemEventsSubscriptionManager : EventsSubscriptionManagerBase { private readonly ISampleSystemDTOMappingService mappingService; - public SampleSystemEventsSubscriptionManager(ISampleSystemBLLContext context, [NotNull] IMessageSender> messageSender) - : base(context, messageSender) + public SampleSystemEventsSubscriptionManager( + [NotNull] IMessageSender> messageSender, + [NotNull] ISampleSystemDTOMappingService mappingService) + : base(messageSender) { - this.mappingService = new SampleSystemServerPrimitiveDTOMappingService(this.Context); + this.mappingService = mappingService ?? throw new ArgumentNullException(nameof(mappingService)); } public override void Subscribe() @@ -29,32 +30,9 @@ public override void Subscribe() this.SubscribeForSaveAndRemoveOperation(); this.SubscribeCustom( - domainObject => true, + _ => true, operation => operation == BLLBaseOperation.Save, domainObject => new EmployeeCustomEventModelSaveEventDTO(this.mappingService, new EmployeeCustomEventModel(domainObject))); } - - private void SubscribeCustom( - Func filter, - Func operationsFilter, - Func convertFunc) - where TDomainObject : PersistentDomainObjectBase - where TOperation : struct, Enum - { - this.Context.OperationListeners.GetEventListener().OperationProcessed += (_, eventArgs) => - { - if (filter(eventArgs.DomainObject) && operationsFilter(eventArgs.Operation)) - { - var message = new DomainOperationSerializeData - { - DomainObject = eventArgs.DomainObject, - Operation = eventArgs.Operation, - CustomSendObject = convertFunc(eventArgs.DomainObject) - }; - - this.MessageSender.Send(message); - } - }; - } } } diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/AuthWorkflow/PermissionWorkflowDALListener.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/AuthWorkflow/PermissionWorkflowDALListener.cs index 3ca500077..b428b2bdb 100644 --- a/src/_SampleSystem/SampleSystem.ServiceEnvironment/AuthWorkflow/PermissionWorkflowDALListener.cs +++ b/src/_SampleSystem/SampleSystem.ServiceEnvironment/AuthWorkflow/PermissionWorkflowDALListener.cs @@ -12,7 +12,7 @@ namespace SampleSystem.ServiceEnvironment; -public class PermissionWorkflowDALListener : BLLContextContainer, IDALListener +public class PermissionWorkflowDALListener : BLLContextContainer, IBeforeTransactionCompletedDALListener { public PermissionWorkflowDALListener([NotNull] ISampleSystemBLLContext context) : base(context) diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystem.ServiceEnvironment.csproj b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystem.ServiceEnvironment.csproj index c3207089a..c4b821a18 100644 --- a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystem.ServiceEnvironment.csproj +++ b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystem.ServiceEnvironment.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemBllContextContainer.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemBllContextContainer.cs deleted file mode 100644 index abde4f762..000000000 --- a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemBllContextContainer.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System; -using System.Collections.Generic; - -using Framework.Authorization.BLL; -using Framework.Authorization.Domain; -using Framework.Authorization.Events; -using Framework.Configuration.BLL; -using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; -using Framework.Core; -using Framework.DomainDriven; -using Framework.DomainDriven.BLL; -using Framework.SecuritySystem.Rules.Builders; -using Framework.DomainDriven.ServiceModel.IAD; -using Framework.Events; -using Framework.Notification.DTO; -using Framework.Notification.New; -using Framework.NotificationCore.Services; -using Framework.NotificationCore.Settings; -using Framework.Persistent; -using Framework.Report; -using Framework.Security.Cryptography; -using Framework.SecuritySystem; -using Framework.Validation; - -using SampleSystem.BLL; -using SampleSystem.Domain; -using SampleSystem.Events; - -using DomainObjectBase = SampleSystem.Domain.DomainObjectBase; -using PersistentDomainObjectBase = SampleSystem.Domain.PersistentDomainObjectBase; -using Principal = Framework.Authorization.Domain.Principal; - -namespace SampleSystem.ServiceEnvironment -{ - public class SampleSystemBllContextContainer : SampleSystemServiceEnvironment.ServiceEnvironmentBLLContextContainer - { - private readonly BLLOperationEventListenerContainer mainOperationListeners = new BLLOperationEventListenerContainer(); - - private readonly BLLSourceEventListenerContainer mainSourceListeners = new BLLSourceEventListenerContainer(); - - private readonly IEventsSubscriptionManager aribaSubscriptionManager; - - - private readonly ValidatorCompileCache defaultAuthorizationValidatorCompileCache; - - private readonly ValidatorCompileCache validatorCompileCache; - - private readonly Func> securityExpressionBuilderFactoryFunc; - - private readonly IFetchService fetchService; - - private readonly ICryptService cryptService; - - private readonly ITypeResolver currentTargetSystemTypeResolver; - - private readonly SmtpSettings smtpSettings; - - private readonly IRewriteReceiversService rewriteReceiversService; - - public SampleSystemBllContextContainer( - SampleSystemServiceEnvironment serviceEnvironment, - IServiceProvider scopedServiceProvider, - ValidatorCompileCache defaultAuthorizationValidatorCompileCache, - ValidatorCompileCache validatorCompileCache, - Func> securityExpressionBuilderFactoryFunc, - IFetchService fetchService, - ICryptService cryptService, - ITypeResolver currentTargetSystemTypeResolver, - IDBSession session, - string currentPrincipalName, - SmtpSettings smtpSettings, - IRewriteReceiversService rewriteReceiversService) - : base(serviceEnvironment, scopedServiceProvider, session, currentPrincipalName) - { - this.defaultAuthorizationValidatorCompileCache = defaultAuthorizationValidatorCompileCache; - this.validatorCompileCache = validatorCompileCache; - this.securityExpressionBuilderFactoryFunc = securityExpressionBuilderFactoryFunc; - this.fetchService = fetchService; - this.cryptService = cryptService; - this.currentTargetSystemTypeResolver = currentTargetSystemTypeResolver; - - this.aribaSubscriptionManager = LazyInterfaceImplementHelper.CreateProxy>( - () => new SampleSystemAribaEventsSubscriptionManager(this.MainContext, new SampleSystemAribaLocalDBEventMessageSender(this.MainContext, this.Configuration))); - - - this.smtpSettings = smtpSettings; - this.rewriteReceiversService = rewriteReceiversService; - } - - - protected override ISampleSystemBLLContext CreateMainContext() - { - var validator = LazyInterfaceImplementHelper.CreateProxy(() => new SampleSystemValidator(this.MainContext, this.validatorCompileCache)); - - var securityExpressionBuilderFactory = this.securityExpressionBuilderFactoryFunc ?? this.GetSecurityExpressionBuilderFactory; - - return new SampleSystemBLLContext( - this.ScopedServiceProvider, - this.Session.GetDALFactory(), - this.mainOperationListeners, - this.mainSourceListeners, - this.Session.GetObjectStateService(), - this.GetAccessDeniedExceptionService(), - this.StandartExpressionBuilder, - validator, - this.HierarchicalObjectExpanderFactory, - this.fetchService, - this.GetDateTimeService(), - LazyInterfaceImplementHelper.CreateProxy(() => new SampleSystemSecurityService(this.MainContext)), - LazyInterfaceImplementHelper.CreateProxy(() => securityExpressionBuilderFactory(this.MainContext)), - LazyInterfaceImplementHelper.CreateProxy(() => new SampleSystemBLLFactoryContainer(this.MainContext)), - this.Authorization, - this.Configuration, - this.cryptService, - this.Impersonate, - this.currentTargetSystemTypeResolver, - this.Session); - } - - public override ISecurityExpressionBuilderFactory GetSecurityExpressionBuilderFactory(TBLLContext context) - { - var materialized = new Framework.SecuritySystem.Rules.Builders.MaterializedPermissions.SecurityExpressionBuilderFactory(context.HierarchicalObjectExpanderFactory, context.Authorization); - - var queryable = new Framework.SecuritySystem.Rules.Builders.QueryablePermissions.SecurityExpressionBuilderFactory(context.HierarchicalObjectExpanderFactory, context.Authorization); - - return new Framework.SecuritySystem.Rules.Builders.Mixed.SecurityExpressionBuilderFactory(materialized, queryable); - } - - /// - /// Пример переопределения валидатора для авторизации - /// - /// - protected override AuthorizationValidator CreateAuthorizationValidator() - { - return new SampleSystemCustomAuthValidator(this.Authorization, this.defaultAuthorizationValidatorCompileCache); - } - protected override IMessageSender GetExceptionSender() - { - return MessageSender.Trace; - } - - ///// - //protected override IMessageSender GetExceptionSender() - //{ - // return MessageSender.Trace; - - // return new SampleSystemExceptionMessageSender( - // this.Configuration, - // SmtpMessageSender.Configuration, - // this.ServiceEnvironment.NotificationContext.Sender, - // this.ServiceEnvironment.NotificationContext.ExceptionReceivers); - //} - - /// - protected override IEnumerable> GetAuthorizationEventDALListeners() - { - foreach (var baseListener in base.GetAuthorizationEventDALListeners()) - { - yield return baseListener; - } - - yield return this.GetAuthEventDALListener(); - } - - private IManualEventDALListener GetAuthEventDALListener() - { - var authEventTypes = new[] - { - TypeEvent.Save(), - TypeEvent.SaveAndRemove(), - TypeEvent.SaveAndRemove() - }; - - var dependencyEvents = new[] - { - TypeEventDependency.FromSaveAndRemove(z => z.Permission), - TypeEventDependency.FromSaveAndRemove(z => z.Principal) - }; - - var messageSender = new AuthorizationLocalDBEventMessageSender(this.Authorization, this.Configuration, "authDALQuery"); - - return new DefaultAuthDALListener(this.Authorization, authEventTypes, messageSender, dependencyEvents); - } - - protected override IEventsSubscriptionManager CreateMainEventsSubscriptionManager() - { - return new SampleSystemEventsSubscriptionManager( - this.MainContext, - new SampleSystemLocalDBEventMessageSender(this.MainContext, this.Configuration)); // Sender для отправки евентов в локальную бд - } - - protected override IEventsSubscriptionManager CreateAuthorizationEventsSubscriptionManager() - { - return new AuthorizationEventsSubscriptionManager( - this.Authorization, - new AuthorizationLocalDBEventMessageSender(this.Authorization, this.Configuration)); // Sender для отправки евентов в локальную бд - } - - protected override IEnumerable GetConfigurationTargetSystemServices(SubscriptionMetadataStore subscriptionMetadataStore) - { - yield return this.GetMainConfigurationTargetSystemService(); - yield return this.GetAuthorizationConfigurationTargetSystemService(); - yield return this.GetConfigurationConfigurationTargetSystemService(); - } - - protected override IBLLSimpleQueryBase GetEmployeeSource(BLLSecurityMode securityMode) - { - return this.MainContext.Logics.EmployeeFactory.Create(securityMode); - } - - /// - /// Сохранение модификаций в локальную бд - /// - /// - protected override IStandardSubscriptionService CreateSubscriptionService() - { - return new LocalDBSubscriptionService(this.Configuration); - } - - ///// - ///// Сохранение нотификаций в локальной бд, откуда их будет забирать Biztalk - ///// - ///// - //protected override IMessageSender GetMessageTemplateSender() - //{ - // return new LocalDBNotificationEventDTOMessageSender(this.Configuration); - //} - - protected override IMessageSender GetMessageTemplateSender() => - new Framework.NotificationCore.Senders.SmtpMessageSender(LazyHelper.Create(() => this.smtpSettings), LazyHelper.Create(() => this.rewriteReceiversService), this.Configuration); - - /// - /// Добавление подписок на евенты для арибы - /// - protected override void SubscribeEvents() - { - base.SubscribeEvents(); - - this.aribaSubscriptionManager.Subscribe(); - } - } -} diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemCustomAuthValidator.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemCustomAuthValidator.cs index b876a12d2..719072091 100644 --- a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemCustomAuthValidator.cs +++ b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemCustomAuthValidator.cs @@ -9,7 +9,7 @@ namespace SampleSystem.ServiceEnvironment /// public class SampleSystemCustomAuthValidator : AuthorizationValidator { - public SampleSystemCustomAuthValidator(IAuthorizationBLLContext context, ValidatorCompileCache cache) + public SampleSystemCustomAuthValidator(IAuthorizationBLLContext context, AuthorizationValidatorCompileCache cache) : base(context, cache) { } diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemInitializer.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemInitializer.cs new file mode 100644 index 000000000..32266cc5f --- /dev/null +++ b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemInitializer.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; + +using Framework.Authorization.BLL; +using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.ServiceModel.IAD; + +using SampleSystem.BLL; + +namespace SampleSystem.ServiceEnvironment; + +public class SampleSystemInitializer +{ + private readonly IContextEvaluator contextEvaluator; + + private readonly SubscriptionMetadataStore subscriptionMetadataStore; + + private readonly IInitializeManager initializeManager; + + public SampleSystemInitializer(IContextEvaluator contextEvaluator, SubscriptionMetadataStore subscriptionMetadataStore, IInitializeManager initializeManager) + { + this.contextEvaluator = contextEvaluator; + this.subscriptionMetadataStore = subscriptionMetadataStore; + this.initializeManager = initializeManager; + } + + public void Initialize() + { + this.initializeManager.InitializeOperation(this.InternalInitialize); + } + + private void InternalInitialize() + { + this.contextEvaluator.Evaluate( + DBSessionMode.Write, + context => + { + context.Configuration.Logics.NamedLock.CheckInit(); + }); + + this.contextEvaluator.Evaluate( + DBSessionMode.Write, + context => + { + context.Logics.NamedLock.CheckInit(); + }); + + this.contextEvaluator.Evaluate( + DBSessionMode.Write, + context => + { + context.Authorization.InitSecurityOperations(); + + context.Configuration.Logics.TargetSystem.RegisterBase(); + context.Configuration.Logics.TargetSystem.Register(true, true); + + var extTypes = new Dictionary + { + { new Guid("{79AF1049-3EC0-46A7-A769-62A24AD4F74E}"), typeof(Framework.Configuration.Domain.Sequence) } + }; + + context.Configuration.Logics.TargetSystem.Register(false, true, extTypes: extTypes); + context.Configuration.Logics.TargetSystem.Register(false, true); + }); + + this.contextEvaluator.Evaluate( + DBSessionMode.Write, + context => + { + context.Configuration.Logics.SystemConstant.Initialize(typeof(SampleSystemSystemConstant)); + }); + + this.contextEvaluator.Evaluate( + DBSessionMode.Write, + context => this.subscriptionMetadataStore.RegisterCodeFirstSubscriptions(context.Configuration.Logics.CodeFirstSubscription, context.Configuration)); + } +} diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSecurityExpressionBuilderFactory.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSecurityExpressionBuilderFactory.cs new file mode 100644 index 000000000..cb33da51a --- /dev/null +++ b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSecurityExpressionBuilderFactory.cs @@ -0,0 +1,18 @@ +using Framework.HierarchicalExpand; +using Framework.Persistent; +using Framework.SecuritySystem; + +using JetBrains.Annotations; + +namespace SampleSystem.ServiceEnvironment; + +public class SampleSystemSecurityExpressionBuilderFactory : Framework.SecuritySystem.Rules.Builders.Mixed.SecurityExpressionBuilderFactory + where TPersistentDomainObjectBase : class, IIdentityObject +{ + public SampleSystemSecurityExpressionBuilderFactory([NotNull] IHierarchicalObjectExpanderFactory hierarchicalObjectExpanderFactory, [NotNull] IAuthorizationSystem authorizationSystem) + : base( + new Framework.SecuritySystem.Rules.Builders.MaterializedPermissions.SecurityExpressionBuilderFactory(hierarchicalObjectExpanderFactory, authorizationSystem), + new Framework.SecuritySystem.Rules.Builders.QueryablePermissions.SecurityExpressionBuilderFactory(hierarchicalObjectExpanderFactory, authorizationSystem)) + { + } +} diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemServiceEnvironment.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemServiceEnvironment.cs deleted file mode 100644 index f35c1ec7a..000000000 --- a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemServiceEnvironment.cs +++ /dev/null @@ -1,152 +0,0 @@ -using System; -using System.Collections.Generic; - -using Framework.Authorization.BLL; -using Framework.Configuration.Domain; -using Framework.Core; -using Framework.Core.Services; -using Framework.DomainDriven; -using Framework.DomainDriven.BLL; -using Framework.DomainDriven.Serialization; -using Framework.DomainDriven.SerializeMetadata; -using Framework.DomainDriven.ServiceModel; -using Framework.DomainDriven.ServiceModel.IAD; -using Framework.NotificationCore.Services; -using Framework.NotificationCore.Settings; -using Framework.Security.Cryptography; -using Framework.SecuritySystem.Rules.Builders; -using Framework.Validation; - -using Microsoft.Extensions.Options; - -using SampleSystem.BLL; -using SampleSystem.Generated.DTO; - -using AuditPersistentDomainObjectBase = SampleSystem.Domain.AuditPersistentDomainObjectBase; -using NamedLock = SampleSystem.Domain.NamedLock; -using NamedLockOperation = SampleSystem.Domain.NamedLockOperation; -using PersistentDomainObjectBase = SampleSystem.Domain.PersistentDomainObjectBase; - -namespace SampleSystem.ServiceEnvironment -{ - public class SampleSystemServiceEnvironment : - ServiceEnvironmentBase, - ISystemMetadataTypeBuilderContainer - { - - protected static readonly ITypeResolver CurrentTargetSystemTypeResolver = new[] { TypeSource.FromSample().ToDefaultTypeResolver(), TypeSource.FromSample().ToDefaultTypeResolver() }.ToComposite(); - - protected ICryptService CryptService { get; } = new CryptService(); - - protected readonly bool? isDebugMode; - protected readonly ValidatorCompileCache ValidatorCompileCache; - protected readonly IFetchService FetchService; - protected readonly Func> SecurityExpressionBuilderFactoryFunc; - - protected readonly SmtpSettings smtpSettings; - - protected readonly IRewriteReceiversService rewriteReceiversService; - - - public SampleSystemServiceEnvironment( - IServiceProvider serviceProvider, - IDBSessionFactory sessionFactory, - INotificationContext notificationContext, - IUserAuthenticationService userAuthenticationService, - IOptions smtpSettings, - IRewriteReceiversService rewriteReceiversService = null, - bool? isDebugMode = null, - Func> securityExpressionBuilderFactoryFunc = null) - : base(serviceProvider, sessionFactory, notificationContext, userAuthenticationService, new SampleSystemSubscriptionsMetadataFinder()) - { - this.SystemMetadataTypeBuilder = new SystemMetadataTypeBuilder(DTORole.All, typeof(PersistentDomainObjectBase).Assembly); - this.SecurityExpressionBuilderFactoryFunc = securityExpressionBuilderFactoryFunc; - this.isDebugMode = isDebugMode; - this.ValidatorCompileCache = - - sessionFactory - .AvailableValues - .ToValidation() - .ToBLLContextValidationExtendedData() - .Pipe(extendedData => new SampleSystemValidationMap(extendedData)) - .ToCompileCache(); - this.FetchService = new SampleSystemMainFetchService().WithCompress().WithCache().WithLock().Add(FetchService.OData); - - this.smtpSettings = smtpSettings.Value; - this.rewriteReceiversService = rewriteReceiversService; - - this.InitializeOperation(this.Initialize); - } - - public ISystemMetadataTypeBuilder SystemMetadataTypeBuilder { get; } - - public override bool IsDebugMode => this.isDebugMode ?? base.IsDebugMode; - - protected override SampleSystemBllContextContainer CreateBLLContextContainer(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName = null) - { - return new SampleSystemBllContextContainer( - this, - scopedServiceProvider, - this.DefaultAuthorizationValidatorCompileCache, - this.ValidatorCompileCache, - this.SecurityExpressionBuilderFactoryFunc, - this.FetchService, - this.CryptService, - CurrentTargetSystemTypeResolver, - session, - currentPrincipalName, - this.smtpSettings, - this.rewriteReceiversService); - } - - - public void Initialize() - { - var contextEvaluator = this.GetContextEvaluator(); - - contextEvaluator.Evaluate( - DBSessionMode.Write, - context => - { - context.Configuration.Logics.NamedLock.CheckInit(); - }); - - contextEvaluator.Evaluate( - DBSessionMode.Write, - context => - { - context.Logics.NamedLock.CheckInit(); - }); - - contextEvaluator.Evaluate( - DBSessionMode.Write, - context => - { - context.Authorization.InitSecurityOperations(); - - context.Configuration.Logics.TargetSystem.RegisterBase(); - context.Configuration.Logics.TargetSystem.Register(true, true); - - var extTypes = new Dictionary - { - { new Guid("{79AF1049-3EC0-46A7-A769-62A24AD4F74E}"), typeof(Framework.Configuration.Domain.Sequence) } - }; - - context.Configuration.Logics.TargetSystem.Register(false, true, extTypes: extTypes); - context.Configuration.Logics.TargetSystem.Register(false, true); - }); - - contextEvaluator.Evaluate( - DBSessionMode.Write, - context => - { - context.Configuration.Logics.SystemConstant.Initialize(typeof(SampleSystemSystemConstant)); - }); - - contextEvaluator.Evaluate( - DBSessionMode.Write, - context => this.SubscriptionMetadataStore.RegisterCodeFirstSubscriptions(context.Configuration.Logics.CodeFirstSubscription, context.Configuration)); - } - } -} diff --git a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSubscriptionsMetadataFinder.cs b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSubscriptionsMetadataFinder.cs index 9784c5ade..55f4adb73 100644 --- a/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSubscriptionsMetadataFinder.cs +++ b/src/_SampleSystem/SampleSystem.ServiceEnvironment/SampleSystemSubscriptionsMetadataFinder.cs @@ -1,5 +1,7 @@ using System.Reflection; + using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; + using SampleSystem.Subscriptions.Metadata.Employee.Update; namespace SampleSystem.ServiceEnvironment diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/Authentication/SampleSystemHangfireAuthorization.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/Authentication/SampleSystemHangfireAuthorization.cs index e9e5e9d50..c58ac0a33 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/Authentication/SampleSystemHangfireAuthorization.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/Authentication/SampleSystemHangfireAuthorization.cs @@ -1,14 +1,11 @@ using System; -using Framework.Core; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; using Framework.NotificationCore.Monitoring; using Hangfire.Dashboard; using SampleSystem.BLL; -using SampleSystem.ServiceEnvironment; using SampleSystem.WebApiCore.Env; namespace SampleSystem.WebApiCore @@ -19,25 +16,25 @@ namespace SampleSystem.WebApiCore /// public class SampleSystemHangfireAuthorization : IDashboardAuthorizationFilter { - private readonly Lazy environment; + private readonly IContextEvaluator contextEvaluator; private readonly IDashboardAuthorizationFilter baseFilter; - public SampleSystemHangfireAuthorization(Lazy environment) + public SampleSystemHangfireAuthorization(IContextEvaluator contextEvaluator) { - this.baseFilter = new AdminHangfireAuthorization(LazyHelper.Create(() => (IServiceEnvironment)this.environment.Value)); + this.baseFilter = new AdminHangfireAuthorization(contextEvaluator); - this.environment = environment; + this.contextEvaluator = contextEvaluator; } public bool Authorize(DashboardContext context) { - return this.environment.Value.GetContextEvaluator().Evaluate( + return this.contextEvaluator.Evaluate( DBSessionMode.Read, z => { return this.baseFilter.Authorize(context) - || string.Compare(z.Authorization.CurrentPrincipalName, UserAuthenticationService.CurrentUser, StringComparison.InvariantCultureIgnoreCase) == 0; + || string.Compare(z.Authorization.CurrentPrincipalName, new DomainDefaultUserAuthenticationService().GetUserName(), StringComparison.InvariantCultureIgnoreCase) == 0; }); } } diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/BusinessUnitController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/BusinessUnitController.cs index 257f48e5b..24e836cf2 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/BusinessUnitController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/BusinessUnitController.cs @@ -2,16 +2,12 @@ using System.Collections.Generic; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.Service; -using Framework.DomainDriven.WebApiNetCore; -using Framework.Exceptions; using Framework.OData; using Framework.Persistent; using Framework.Transfering; using Microsoft.AspNetCore.Mvc; -using SampleSystem.BLL; using SampleSystem.Domain; using SampleSystem.Generated.DTO; @@ -36,19 +32,19 @@ public List> GetFullBusinessUnitsTre public SelectOperationResult> GetFullBusinessUnitsTreeByOData(string odataQueryString) { return this.Evaluate( - DBSessionMode.Read, - evaluateData => - { - var bll = evaluateData.Context.Logics.BusinessUnit; - var selectOperation = evaluateData.Context.SelectOperationParser.Parse(odataQueryString); - var typedSelectOperation = evaluateData.Context.StandartExpressionBuilder.ToTyped(selectOperation); - - var odataTree = bll.GetTreeByOData( - typedSelectOperation, - evaluateData.Context.FetchService.GetContainer(ViewDTOType.FullDTO)); - - return odataTree.SelectN(x => x.ToFullDTO(evaluateData.MappingService)); - }); + DBSessionMode.Read, + evaluateData => + { + var bll = evaluateData.Context.Logics.BusinessUnit; + var selectOperation = evaluateData.Context.SelectOperationParser.Parse(odataQueryString); + var typedSelectOperation = evaluateData.Context.StandartExpressionBuilder.ToTyped(selectOperation); + + var odataTree = bll.GetTreeByOData( + typedSelectOperation, + evaluateData.Context.FetchService.GetContainer(ViewDTOType.FullDTO)); + + return odataTree.SelectN(x => x.ToFullDTO(evaluateData.MappingService)); + }); } [HttpPost(nameof(TestPeriod))] diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/CapIntegrationController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/CapIntegrationController.cs index 5645f3059..2e9ea3f3b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/CapIntegrationController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/CapIntegrationController.cs @@ -6,7 +6,6 @@ using Framework.DomainDriven.BLL; using Framework.DomainDriven.ServiceModel.Service; using Framework.DomainDriven.WebApiNetCore; -using Framework.Exceptions; using MediatR; @@ -22,18 +21,14 @@ namespace SampleSystem.WebApiCore [ApiVersion("1.0")] [Route("api/v{version:apiVersion}/[controller]/[action]")] public class CapIntegrationController : ApiControllerBase< - IServiceEnvironment, ISampleSystemBLLContext, EvaluatedData< ISampleSystemBLLContext, ISampleSystemDTOMappingService>> { private readonly IMediator mediator; public CapIntegrationController( - IServiceEnvironment serviceEnvironment, - IExceptionProcessor exceptionProcessor, IMediator mediator, IServiceProvider serviceProvider) - : base(serviceEnvironment, exceptionProcessor) { this.mediator = mediator; diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/IntegrationController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/IntegrationController.cs index 2a588243c..eea92c64c 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/IntegrationController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/IntegrationController.cs @@ -3,6 +3,7 @@ using System.Linq; using Framework.Authorization.Generated.DTO; using Framework.Core; +using Framework.DomainDriven; using Framework.DomainDriven.BLL; using Framework.DomainDriven.BLL.Security; using Framework.DomainDriven.ServiceModel.Service; @@ -11,17 +12,17 @@ using Microsoft.AspNetCore.Mvc; using SampleSystem.BLL; using SampleSystem.Generated.DTO; +using SampleSystem.ServiceEnvironment; namespace SampleSystem.WebApiCore.Controllers { [ApiVersion("1.0")] [Route("api/v{version:apiVersion}/[controller]")] [ApiController] - public class IntegrationController : IntegrationSchemaControllerBase, - ISampleSystemBLLContext, EvaluatedData> + public class IntegrationController : IntegrationSchemaControllerBase> { - public IntegrationController(IServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + public IntegrationController(IDateTimeService dateTimeService) + : base(dateTimeService) { } @@ -31,7 +32,7 @@ protected override void CheckAccess(EvaluatedData GetEvaluatedData(IDBSession session, ISampleSystemBLLContext context) => - new EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); + new(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); protected override IEnumerable GetEventDTOTypes() { diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/MediatrController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/MediatrController.cs index 0eede6a8d..ec713df9d 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/MediatrController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/MediatrController.cs @@ -22,17 +22,12 @@ namespace SampleSystem.WebApiCore.Controllers [ApiVersion("1.0")] [Route("authApi/v{version:apiVersion}/[controller]/[action]")] public class MediatrController : ApiControllerBase< - IServiceEnvironment, ISampleSystemBLLContext, EvaluatedData< ISampleSystemBLLContext, ISampleSystemDTOMappingService>> { private readonly IMediator mediator; - public MediatrController( - IServiceEnvironment serviceEnvironment, - IExceptionProcessor exceptionProcessor, - IMediator mediator) - : base(serviceEnvironment, exceptionProcessor) => + public MediatrController(IMediator mediator) => this.mediator = mediator; [HttpGet] diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/AuthSLJsonController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/AuthSLJsonController.cs index ee5cc9210..d0007de68 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/AuthSLJsonController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/AuthSLJsonController.cs @@ -14,8 +14,8 @@ namespace SampleSystem.WebApiCore.Controllers { public class AuthSLJsonController : Framework.Authorization.WebApi.AuthSLJsonController { - public AuthSLJsonController(IServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + public AuthSLJsonController() + { } diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/ConfigSLJsonController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/ConfigSLJsonController.cs index 3716f456c..6d52d4bf8 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/ConfigSLJsonController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SL/ConfigSLJsonController.cs @@ -14,8 +14,8 @@ namespace SampleSystem.WebApiCore.Controllers { public class ConfigSLJsonController : Framework.Configuration.WebApi.ConfigSLJsonController { - public ConfigSLJsonController(IServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + public ConfigSLJsonController() + { } diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SampleSystemGenericReportController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SampleSystemGenericReportController.cs index 8c53e1b8e..61fe1a546 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SampleSystemGenericReportController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/SampleSystemGenericReportController.cs @@ -1,7 +1,10 @@ using System; +using Framework.CustomReports.Domain; +using Framework.CustomReports.Services; using Framework.CustomReports.WebApi; using Framework.DomainDriven.BLL; +using Framework.DomainDriven.SerializeMetadata; using Framework.DomainDriven.ServiceModel.Service; using Framework.Exceptions; @@ -18,12 +21,12 @@ namespace SampleSystem.WebApiCore.Controllers.Report [ApiController] [ApiVersion("1.0")] [Route("reportApi/v{version:apiVersion}/[controller]")] - public class SampleSystemGenericReportController : GenericReportControllerBase { - public SampleSystemGenericReportController(SampleSystemCustomReportsServiceEnvironment environment, IExceptionProcessor exceptionProcessor) - : base(environment, exceptionProcessor) + public SampleSystemGenericReportController(ISystemMetadataTypeBuilder systemMetadataTypeBuilder, IReportParameterValueService reportParameterValueService, IReportService reportService, ISecurityOperationCodeProvider securityOperationCodeProvider) + : base(systemMetadataTypeBuilder, reportParameterValueService, reportService, securityOperationCodeProvider) { } diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/TestAsyncController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/TestAsyncController.cs new file mode 100644 index 000000000..2d99a9dc4 --- /dev/null +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/TestAsyncController.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +using Framework.DomainDriven.BLL; +using Framework.SecuritySystem; + +using Microsoft.AspNetCore.Mvc; + +using SampleSystem.BLL; +using SampleSystem.Generated.DTO; + +namespace SampleSystem.WebApiCore.Controllers.Main; + +[ApiVersion("1.0")] +[Route("api/v{version:apiVersion}/[controller]")] +[ApiController] +public class TestAsyncController : ControllerBase +{ + private readonly ILocationBLLFactory buFactory; + + private readonly IDBSession session; + + private readonly ISampleSystemDTOMappingService mappingService; + + public TestAsyncController(ILocationBLLFactory buFactory, IDBSession session, ISampleSystemDTOMappingService mappingService) + { + this.buFactory = buFactory; + this.session = session; + this.mappingService = mappingService; + } + + [HttpPost(nameof(AsyncGetLocations))] + public async Task> AsyncGetLocations(CancellationToken cancellationToken = default) + { + this.session.AsReadOnly(); + + var bll = this.buFactory.Create(BLLSecurityMode.View); + + return bll.GetFullList().ToSimpleDTOList(this.mappingService); + } + + + [HttpPost(nameof(AsyncSaveLocation))] + public async Task AsyncSaveLocation(LocationStrictDTO businessUnitStrictDTO, CancellationToken cancellationToken = default) + { + var bll = this.buFactory.Create(BLLSecurityMode.Edit); + + var bu = businessUnitStrictDTO.ToDomainObject(this.mappingService, true); + + bll.Save(bu); + + return bu.ToIdentityDTO(); + } +} diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/WorkflowController.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/WorkflowController.cs index edf0a3595..c3e17bcc5 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/WorkflowController.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/WorkflowController.cs @@ -29,9 +29,7 @@ namespace SampleSystem.WebApiCore.Controllers; [ApiVersion("1.0")] [Route("api/v{version:apiVersion}/[controller]")] [ApiController] -public class WorkflowController : ApiControllerBase< - IServiceEnvironment, - ISampleSystemBLLContext, EvaluatedData> +public class WorkflowController : ApiControllerBase> { private readonly StartWorkflowJob startWorkflowJob; @@ -39,17 +37,19 @@ public class WorkflowController : ApiControllerBase< private readonly IUserAuthenticationService userAuthenticationService; + private readonly IContextEvaluator contextEvaluator; + public WorkflowController( - IServiceEnvironment environment, - IExceptionProcessor exceptionProcessor, StartWorkflowJob startWorkflowJob, IWorkflowHost workflowHost, - IUserAuthenticationService userAuthenticationService) - : base(environment, exceptionProcessor) + IUserAuthenticationService userAuthenticationService, + IContextEvaluator contextEvaluator) + { this.startWorkflowJob = startWorkflowJob; this.workflowHost = workflowHost; this.userAuthenticationService = userAuthenticationService; + this.contextEvaluator = contextEvaluator; } protected override EvaluatedData GetEvaluatedData(IDBSession session, ISampleSystemBLLContext context) => @@ -67,11 +67,11 @@ public Dictionary StartJob() [HttpPost(nameof(GetMyPendingApproveOperationWorkflowObjects))] public async Task> GetMyPendingApproveOperationWorkflowObjects(PermissionIdentityDTO permissionIdent) { - var workflowOperationIdents = this.Evaluate(DBSessionMode.Read, evaluateData => + var workflowOperationIdents = this.contextEvaluator.Evaluate(DBSessionMode.Read, ctx => { var permissionIdStr = permissionIdent.Id.ToString(); - var bll = evaluateData.Context.Logics.Default.Create(); + var bll = ctx.Logics.Default.Create(); var instances = bll.GetListBy(wi => wi.Data.Contains(permissionIdStr) @@ -95,9 +95,9 @@ public async Task> GetMyPendingApproveOpera } } - this.Evaluate(DBSessionMode.Read, evaluateData => + this.contextEvaluator.Evaluate(DBSessionMode.Read, ctx => { - var authContext = evaluateData.Context.Authorization; + var authContext = ctx.Authorization; result.RemoveAll(wfObj => { @@ -122,11 +122,11 @@ public Task RejectOperation(PermissionIdentityDTO permissionIdentity, string rej return this.ApproveRejectOperation(permissionIdentity, rejectEventId, false); } - public async Task ApproveRejectOperation(PermissionIdentityDTO permissionIdentity, string eventId, bool isApprove) + private async Task ApproveRejectOperation(PermissionIdentityDTO permissionIdentity, string eventId, bool isApprove) { var permissionIdStr = permissionIdentity.Id.ToString(); - var wiId = this.EvaluateC( + var wiId = this.contextEvaluator.Evaluate( DBSessionMode.Read, ctx => ctx.Logics.WorkflowCoreInstance.GetObjectBy(ee => ee.Data.Contains(permissionIdStr) && ee.Data.Contains(eventId), true).Id); @@ -134,7 +134,7 @@ public async Task ApproveRejectOperation(PermissionIdentityDTO permissionIdentit await Task.Delay(3000); // need refact - this.EvaluateC( + this.contextEvaluator.Evaluate( DBSessionMode.Read, ctx => { diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitHrDepartmentService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitHrDepartmentService.Generated.cs index 490e1729c..e83712df3 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitHrDepartmentService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitHrDepartmentService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitHrDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitHrDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitHrDepartmentController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get BusinessUnitHrDepartment Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitManagerCommissionLinkService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitManagerCommissionLinkService.Generated.cs index 797237b4b..1818fb852 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitManagerCommissionLinkService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitManagerCommissionLinkService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitManagerCommissionLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitManagerCommissionLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitManagerCommissionLinkController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get BusinessUnitManagerCommissionLink Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitService.Generated.cs index 2aa8d8341..5ae35cdba 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get BusinessUnit Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitTypeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitTypeService.Generated.cs index a23764947..ec66575cd 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitTypeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/BusinessUnitTypeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitTypeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get BusinessUnitType Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CompanyLegalEntityService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CompanyLegalEntityService.Generated.cs index 2c42dfd6a..faa97e2ca 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CompanyLegalEntityService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CompanyLegalEntityService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class CompanyLegalEntityController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CompanyLegalEntityController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CompanyLegalEntityController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get CompanyLegalEntity Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CountryService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CountryService.Generated.cs index 5e4a5bf11..6a3bb3b02 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CountryService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/CountryService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class CountryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CountryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CountryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get Country Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeInformationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeInformationService.Generated.cs index 6316e6833..c37680b7f 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeInformationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeInformationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeInformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeInformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeInformationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeeInformation Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePhotoService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePhotoService.Generated.cs index 1625b6b54..88e44dec4 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePhotoService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePhotoService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeePhotoController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeePhotoController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeePhotoController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeePhoto Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePositionService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePositionService.Generated.cs index 0323d4868..804a04862 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePositionService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeePositionService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeePositionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeePositionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeePositionController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeePosition Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRegistrationTypeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRegistrationTypeService.Generated.cs index 8919f6b5a..d0be0c501 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRegistrationTypeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRegistrationTypeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeRegistrationTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRegistrationTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRegistrationTypeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeeRegistrationType Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleDegreeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleDegreeService.Generated.cs index cc277ece5..419151510 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleDegreeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleDegreeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeRoleDegreeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRoleDegreeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRoleDegreeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeeRoleDegree Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleService.Generated.cs index 220a75982..27a0595e2 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeRoleService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeRoleController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRoleController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRoleController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeeRole Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeService.Generated.cs index d9ea35df6..ada6bcbf1 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get Employee Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeSpecializationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeSpecializationService.Generated.cs index 2df483d25..4e8e8e60a 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeSpecializationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/EmployeeSpecializationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeSpecializationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeSpecializationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeSpecializationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeeSpecialization Property Revisions by period /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Example1Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Example1Service.Generated.cs index f84ac40db..90474ec92 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Example1Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Example1Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class Example1Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class Example1Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public Example1Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/HRDepartmentService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/HRDepartmentService.Generated.cs index 7b2da8844..0d62f35e8 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/HRDepartmentService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/HRDepartmentService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class HRDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class HRDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public HRDepartmentController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/IMRequestService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/IMRequestService.Generated.cs index 8f74d9ea8..e98341c0a 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/IMRequestService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/IMRequestService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class IMRequestController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class IMRequestController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public IMRequestController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/InformationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/InformationService.Generated.cs index 21d856547..b52b2e022 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/InformationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/InformationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class InformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class InformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public InformationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Location1676Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Location1676Service.Generated.cs index 0017f5e0e..0db1d13ae 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Location1676Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/Location1676Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class Location1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class Location1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public Location1676Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/LocationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/LocationService.Generated.cs index 59d610faf..84eba58c4 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/LocationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/LocationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class LocationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class LocationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public LocationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndBusinessUnitLinkService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndBusinessUnitLinkService.Generated.cs index 0409a361a..9d4b6c6a7 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndBusinessUnitLinkService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndBusinessUnitLinkService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitAndBusinessUnitLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitAndBusinessUnitLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitAndBusinessUnitLinkController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndHRDepartmentLinkService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndHRDepartmentLinkService.Generated.cs index 91730d8c1..5be45f833 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndHRDepartmentLinkService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitAndHRDepartmentLinkService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitAndHRDepartmentLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitAndHRDepartmentLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitAndHRDepartmentLinkController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitService.Generated.cs index de8afbd57..7a4294228 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/ManagementUnitService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/PrincipalService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/PrincipalService.Generated.cs index b77ee73cc..83be576a7 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/PrincipalService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/PrincipalService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class PrincipalController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class PrincipalController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public PrincipalController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjContainerService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjContainerService.Generated.cs index d748131ad..69ead4440 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjContainerService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjContainerService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class SqlParserTestObjContainerController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SqlParserTestObjContainerController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SqlParserTestObjContainerController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjService.Generated.cs index 4832a3039..cad88a3e9 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/SqlParserTestObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class SqlParserTestObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SqlParserTestObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SqlParserTestObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestCustomContextSecurityObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestCustomContextSecurityObjService.Generated.cs index 2cf7bcc5d..249fb0ebd 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestCustomContextSecurityObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestCustomContextSecurityObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestCustomContextSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestCustomContextSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestCustomContextSecurityObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestImmutableObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestImmutableObjService.Generated.cs index 4e14621b4..68cece7fb 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestImmutableObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestImmutableObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestImmutableObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestImmutableObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestImmutableObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPerformanceObjectService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPerformanceObjectService.Generated.cs index 705964d33..adae8bd27 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPerformanceObjectService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPerformanceObjectService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestPerformanceObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestPerformanceObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestPerformanceObjectController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPlainAuthObjectService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPlainAuthObjectService.Generated.cs index 3c3124115..31433d6ed 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPlainAuthObjectService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestPlainAuthObjectService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestPlainAuthObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestPlainAuthObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestPlainAuthObjectController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestRootSecurityObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestRootSecurityObjService.Generated.cs index 0b12e532c..95e7221fa 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestRootSecurityObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestRootSecurityObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestRootSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestRootSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestRootSecurityObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecurityObjItemService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecurityObjItemService.Generated.cs index 31c89533b..7334aae3b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecurityObjItemService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecurityObjItemService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestSecurityObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecurityObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecurityObjItemController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem2Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem2Service.Generated.cs index c441615ec..37960b563 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem2Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem2Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItem2Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItem2Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItem2Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem3Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem3Service.Generated.cs index e1cd6591b..ea9265d76 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem3Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItem3Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItem3Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItem3Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItem3Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItemService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItemService.Generated.cs index 0567d331a..479599be4 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItemService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/TestSecuritySubObjItemService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItemController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/WorkingCalendar1676Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/WorkingCalendar1676Service.Generated.cs index 72ffb44e9..b3085e8ca 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/WorkingCalendar1676Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Audit/WorkingCalendar1676Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainAuditApi/v{version:apiVersion}/[controller]")] - public partial class WorkingCalendar1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class WorkingCalendar1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public WorkingCalendar1676Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/BusinessRoleService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/BusinessRoleService.Generated.cs index 6d29073ee..bc376e67d 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/BusinessRoleService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/BusinessRoleService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("authApi/v{version:apiVersion}/[controller]")] - public partial class BusinessRoleController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Authorization.BLL.IAuthorizationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessRoleController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessRoleController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check BusinessRole access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/EntityTypeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/EntityTypeService.Generated.cs index a262e19ef..9b9c42443 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/EntityTypeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/EntityTypeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("authApi/v{version:apiVersion}/[controller]")] - public partial class EntityTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Authorization.BLL.IAuthorizationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EntityTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EntityTypeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EntityType access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/OperationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/OperationService.Generated.cs index cb6b2fca3..48df4b969 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/OperationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/OperationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("authApi/v{version:apiVersion}/[controller]")] - public partial class OperationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Authorization.BLL.IAuthorizationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class OperationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public OperationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Operation access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PermissionService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PermissionService.Generated.cs index f67f239b5..0173d1c7a 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PermissionService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PermissionService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("authApi/v{version:apiVersion}/[controller]")] - public partial class PermissionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Authorization.BLL.IAuthorizationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class PermissionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public PermissionController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Permission access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PrincipalService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PrincipalService.Generated.cs index b077d8dc5..049d1d7bc 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PrincipalService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Auth/PrincipalService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("authApi/v{version:apiVersion}/[controller]")] - public partial class PrincipalController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Authorization.BLL.IAuthorizationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class PrincipalController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public PrincipalController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Principal access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/CodeFirstSubscriptionService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/CodeFirstSubscriptionService.Generated.cs index 4aad5bc4b..d798a9424 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/CodeFirstSubscriptionService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/CodeFirstSubscriptionService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class CodeFirstSubscriptionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CodeFirstSubscriptionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CodeFirstSubscriptionController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check CodeFirstSubscription access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/DomainTypeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/DomainTypeService.Generated.cs index 08bb26651..82c6c2ea6 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/DomainTypeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/DomainTypeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class DomainTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class DomainTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public DomainTypeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check DomainType access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ExceptionMessageService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ExceptionMessageService.Generated.cs index 4814a3077..74634d41b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ExceptionMessageService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ExceptionMessageService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class ExceptionMessageController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ExceptionMessageController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ExceptionMessageController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ExceptionMessage access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportFilterService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportFilterService.Generated.cs index 5defaef56..6127523f6 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportFilterService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportFilterService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class ReportFilterController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ReportFilterController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ReportFilterController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ReportFilter access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportParameterService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportParameterService.Generated.cs index 1af76e143..f0396c246 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportParameterService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportParameterService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class ReportParameterController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ReportParameterController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ReportParameterController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ReportParameter access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportPropertyService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportPropertyService.Generated.cs index d82e9b90b..a02d781e4 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportPropertyService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportPropertyService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class ReportPropertyController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ReportPropertyController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ReportPropertyController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ReportProperty access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportService.Generated.cs index 2c61c73ac..b3e6f5e65 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/ReportService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class ReportController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ReportController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ReportController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Report access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SequenceService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SequenceService.Generated.cs index c5c8c62ea..d61ccafb2 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SequenceService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SequenceService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class SequenceController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SequenceController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SequenceController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Sequence access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SystemConstantService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SystemConstantService.Generated.cs index ec598d60a..a61ed6a64 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SystemConstantService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/SystemConstantService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class SystemConstantController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SystemConstantController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SystemConstantController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check SystemConstant access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/TargetSystemService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/TargetSystemService.Generated.cs index 3cc9e044d..b72caadfc 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/TargetSystemService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Configuration/TargetSystemService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("configApi/v{version:apiVersion}/[controller]")] - public partial class TargetSystemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, Framework.Configuration.BLL.IConfigurationBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TargetSystemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TargetSystemController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check TargetSystem access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/CustomReport/EmployeeReportParameterService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/CustomReport/EmployeeReportParameterService.Generated.cs index 2f2fd3753..85498bd99 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/CustomReport/EmployeeReportParameterService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/CustomReport/EmployeeReportParameterService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("reportAuditApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeReportParameterController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeReportParameterController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeReportParameterController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Get EmployeeReport custom report /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/EmployeeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/EmployeeService.Generated.cs index f86667ac8..d6b6a1e40 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/EmployeeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/EmployeeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("integrationApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer1Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer1Service.Generated.cs index 9c638006e..f79e5e65e 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer1Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer1Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("integrationApi/v{version:apiVersion}/[controller]")] - public partial class IntegrationVersionContainer1Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class IntegrationVersionContainer1Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public IntegrationVersionContainer1Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer2Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer2Service.Generated.cs index b90d5a672..59e048ab3 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer2Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/IntegrationVersionContainer2Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("integrationApi/v{version:apiVersion}/[controller]")] - public partial class IntegrationVersionContainer2Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class IntegrationVersionContainer2Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public IntegrationVersionContainer2Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/TestImmutableObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/TestImmutableObjService.Generated.cs index 1b970604f..95aee5461 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/TestImmutableObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Integration/TestImmutableObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("integrationApi/v{version:apiVersion}/[controller]")] - public partial class TestImmutableObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestImmutableObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestImmutableObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitHrDepartmentService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitHrDepartmentService.Generated.cs index d1faea8ad..369abca62 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitHrDepartmentService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitHrDepartmentService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitHrDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitHrDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitHrDepartmentController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check BusinessUnitHrDepartment access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitManagerCommissionLinkService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitManagerCommissionLinkService.Generated.cs index 8904be677..2021b6968 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitManagerCommissionLinkService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitManagerCommissionLinkService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitManagerCommissionLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitManagerCommissionLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitManagerCommissionLinkController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check BusinessUnitManagerCommissionLink access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitService.Generated.cs index 4c38b4f52..6500ff5ca 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check BusinessUnit access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitTypeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitTypeService.Generated.cs index 2b57141f3..925a6ac92 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitTypeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/BusinessUnitTypeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitTypeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check BusinessUnitType access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CompanyLegalEntityService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CompanyLegalEntityService.Generated.cs index dc8bbb9ec..9bfc7b5d3 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CompanyLegalEntityService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CompanyLegalEntityService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class CompanyLegalEntityController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CompanyLegalEntityController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CompanyLegalEntityController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check CompanyLegalEntity access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CountryService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CountryService.Generated.cs index 74eca958e..1ee186c26 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CountryService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/CountryService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class CountryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CountryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CountryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Country access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeInformationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeInformationService.Generated.cs index 680d53a8b..64ff4d045 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeInformationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeInformationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeeInformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeInformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeInformationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeeInformation access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePhotoService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePhotoService.Generated.cs index d964768d9..eb2a172dc 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePhotoService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePhotoService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeePhotoController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeePhotoController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeePhotoController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeePhoto access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePositionService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePositionService.Generated.cs index 8eaa825d5..8e098593b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePositionService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeePositionService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeePositionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeePositionController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeePositionController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeePosition access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRegistrationTypeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRegistrationTypeService.Generated.cs index c15705d36..9544b18b7 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRegistrationTypeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRegistrationTypeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeeRegistrationTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRegistrationTypeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRegistrationTypeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeeRegistrationType access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleDegreeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleDegreeService.Generated.cs index 986d51f43..19e52114b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleDegreeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleDegreeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeeRoleDegreeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRoleDegreeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRoleDegreeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeeRoleDegree access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleService.Generated.cs index f7eb2b75e..4f05910c4 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeRoleService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeeRoleController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRoleController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRoleController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeeRole access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeService.Generated.cs index 93d040e15..0c0865514 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Change Employee by model (EmployeeComplexChangeModel) /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeSpecializationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeSpecializationService.Generated.cs index c88f0c883..eda035264 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeSpecializationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/EmployeeSpecializationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class EmployeeSpecializationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeSpecializationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeSpecializationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check EmployeeSpecialization access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Example1Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Example1Service.Generated.cs index d635f84c5..ea1c04589 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Example1Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Example1Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class Example1Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class Example1Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public Example1Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Example1 access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/HRDepartmentService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/HRDepartmentService.Generated.cs index 4696b3e0d..d8fbe75d3 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/HRDepartmentService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/HRDepartmentService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class HRDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class HRDepartmentController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public HRDepartmentController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check HRDepartment access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/IMRequestService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/IMRequestService.Generated.cs index a607a873b..2b72a8b3b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/IMRequestService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/IMRequestService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class IMRequestController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class IMRequestController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public IMRequestController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check IMRequest access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/InformationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/InformationService.Generated.cs index 16a18daa8..345966b99 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/InformationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/InformationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class InformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class InformationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public InformationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Information access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Location1676Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Location1676Service.Generated.cs index d785ba996..0c558f27e 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Location1676Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/Location1676Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class Location1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class Location1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public Location1676Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Location1676 access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/LocationService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/LocationService.Generated.cs index 521543051..0cd34927a 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/LocationService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/LocationService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class LocationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class LocationController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public LocationController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Location access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndBusinessUnitLinkService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndBusinessUnitLinkService.Generated.cs index 03358dcf5..b30ee4d65 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndBusinessUnitLinkService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndBusinessUnitLinkService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitAndBusinessUnitLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitAndBusinessUnitLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitAndBusinessUnitLinkController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ManagementUnitAndBusinessUnitLink access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndHRDepartmentLinkService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndHRDepartmentLinkService.Generated.cs index 9509867b2..e137ef048 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndHRDepartmentLinkService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitAndHRDepartmentLinkService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitAndHRDepartmentLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitAndHRDepartmentLinkController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitAndHRDepartmentLinkController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ManagementUnitAndHRDepartmentLink access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitService.Generated.cs index 355d4b70b..d693a12c5 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/ManagementUnitService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check ManagementUnit access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/PrincipalService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/PrincipalService.Generated.cs index dca8b4ebc..d41c2fc58 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/PrincipalService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/PrincipalService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class PrincipalController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class PrincipalController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public PrincipalController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check Principal access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjContainerService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjContainerService.Generated.cs index c4d01f9f8..ecb6f814e 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjContainerService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjContainerService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class SqlParserTestObjContainerController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SqlParserTestObjContainerController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SqlParserTestObjContainerController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check SqlParserTestObjContainer access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjService.Generated.cs index de2c80d11..6cd8d81be 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/SqlParserTestObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class SqlParserTestObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SqlParserTestObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SqlParserTestObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check SqlParserTestObj access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestCustomContextSecurityObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestCustomContextSecurityObjService.Generated.cs index 83c31a008..16c493b98 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestCustomContextSecurityObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestCustomContextSecurityObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestCustomContextSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestCustomContextSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestCustomContextSecurityObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestImmutableObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestImmutableObjService.Generated.cs index e93152f07..75fa4a899 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestImmutableObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestImmutableObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestImmutableObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestImmutableObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestImmutableObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check TestImmutableObj access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPerformanceObjectService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPerformanceObjectService.Generated.cs index 5c0addff0..81f10ed73 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPerformanceObjectService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPerformanceObjectService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestPerformanceObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestPerformanceObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestPerformanceObjectController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check TestPerformanceObject access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPlainAuthObjectService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPlainAuthObjectService.Generated.cs index a1dbab7cd..4399fbe94 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPlainAuthObjectService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestPlainAuthObjectService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestPlainAuthObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestPlainAuthObjectController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestPlainAuthObjectController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check TestPlainAuthObject access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestRootSecurityObjService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestRootSecurityObjService.Generated.cs index c16e15d2e..24ed21499 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestRootSecurityObjService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestRootSecurityObjService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestRootSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestRootSecurityObjController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestRootSecurityObjController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check TestRootSecurityObj access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecurityObjItemService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecurityObjItemService.Generated.cs index d21d02921..ccc9895ae 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecurityObjItemService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecurityObjItemService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestSecurityObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecurityObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecurityObjItemController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem2Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem2Service.Generated.cs index a67573aa6..d175f79b9 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem2Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem2Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItem2Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItem2Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItem2Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem3Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem3Service.Generated.cs index 1981fd933..1e29f4bb2 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem3Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItem3Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItem3Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItem3Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItem3Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItemService.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItemService.Generated.cs index becebdda2..e39625e79 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItemService.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/TestSecuritySubObjItemService.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItemController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItemController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/WorkingCalendar1676Service.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/WorkingCalendar1676Service.Generated.cs index 7157f038d..a41e258a5 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/WorkingCalendar1676Service.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/Main/WorkingCalendar1676Service.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("api/v{version:apiVersion}/[controller]")] - public partial class WorkingCalendar1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class WorkingCalendar1676Controller : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public WorkingCalendar1676Controller(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - /// /// Check WorkingCalendar1676 access /// diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitHrDepartmentServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitHrDepartmentServiceQuery.Generated.cs index 4be65630c..a60786559 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitHrDepartmentServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitHrDepartmentServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitHrDepartmentQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitHrDepartmentQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitHrDepartmentQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitManagerCommissionLinkServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitManagerCommissionLinkServiceQuery.Generated.cs index 6c25292c7..441fb59ec 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitManagerCommissionLinkServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitManagerCommissionLinkServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitManagerCommissionLinkQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitManagerCommissionLinkQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitManagerCommissionLinkQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitServiceQuery.Generated.cs index 4f5293225..e0cc604ed 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitTypeServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitTypeServiceQuery.Generated.cs index e20086d7b..05a3ae71f 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitTypeServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/BusinessUnitTypeServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class BusinessUnitTypeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class BusinessUnitTypeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public BusinessUnitTypeQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CompanyLegalEntityServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CompanyLegalEntityServiceQuery.Generated.cs index f25d8a3ac..23c66396d 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CompanyLegalEntityServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CompanyLegalEntityServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class CompanyLegalEntityQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CompanyLegalEntityQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CompanyLegalEntityQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CountryServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CountryServiceQuery.Generated.cs index 177d2e9bb..a3e843f8f 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CountryServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/CountryServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class CountryQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class CountryQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public CountryQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeInformationServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeInformationServiceQuery.Generated.cs index 0bee0f5b4..b7fc30f60 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeInformationServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeInformationServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeInformationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeInformationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeInformationQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePhotoServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePhotoServiceQuery.Generated.cs index 2c7e4ec31..63a6ceae4 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePhotoServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePhotoServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeePhotoQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeePhotoQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeePhotoQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePositionServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePositionServiceQuery.Generated.cs index 667862c1e..b83779edb 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePositionServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeePositionServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeePositionQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeePositionQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeePositionQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRegistrationTypeServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRegistrationTypeServiceQuery.Generated.cs index 0aa6a4332..4cad5a857 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRegistrationTypeServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRegistrationTypeServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeRegistrationTypeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRegistrationTypeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRegistrationTypeQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleDegreeServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleDegreeServiceQuery.Generated.cs index 251ed2356..6e41003ee 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleDegreeServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleDegreeServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeRoleDegreeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRoleDegreeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRoleDegreeQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleServiceQuery.Generated.cs index e7bb10485..aa0d99868 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeRoleServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeRoleQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeRoleQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeRoleQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeServiceQuery.Generated.cs index cc51c33e4..eda230590 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeSpecializationServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeSpecializationServiceQuery.Generated.cs index fe82f9cad..4f09b3c05 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeSpecializationServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/EmployeeSpecializationServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class EmployeeSpecializationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class EmployeeSpecializationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public EmployeeSpecializationQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Example1ServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Example1ServiceQuery.Generated.cs index c77959516..d06417b14 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Example1ServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Example1ServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class Example1QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class Example1QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public Example1QueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/HRDepartmentServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/HRDepartmentServiceQuery.Generated.cs index 9e9f6e4a6..8b824518c 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/HRDepartmentServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/HRDepartmentServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class HRDepartmentQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class HRDepartmentQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public HRDepartmentQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/IMRequestServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/IMRequestServiceQuery.Generated.cs index a5afa2237..0f09c1880 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/IMRequestServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/IMRequestServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class IMRequestQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class IMRequestQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public IMRequestQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/InformationServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/InformationServiceQuery.Generated.cs index 2c7bfb2da..580bb0eaa 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/InformationServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/InformationServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class InformationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class InformationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public InformationQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Location1676ServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Location1676ServiceQuery.Generated.cs index 561b1d9b9..7713bbb39 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Location1676ServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/Location1676ServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class Location1676QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class Location1676QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public Location1676QueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/LocationServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/LocationServiceQuery.Generated.cs index 3144c2aaf..a8e7acb7d 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/LocationServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/LocationServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class LocationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class LocationQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public LocationQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndBusinessUnitLinkServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndBusinessUnitLinkServiceQuery.Generated.cs index 88dbaa7a9..6d5c142c0 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndBusinessUnitLinkServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndBusinessUnitLinkServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitAndBusinessUnitLinkQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitAndBusinessUnitLinkQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitAndBusinessUnitLinkQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndHRDepartmentLinkServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndHRDepartmentLinkServiceQuery.Generated.cs index 24ac1cbe7..ea1687915 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndHRDepartmentLinkServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitAndHRDepartmentLinkServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitAndHRDepartmentLinkQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitAndHRDepartmentLinkQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitAndHRDepartmentLinkQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitServiceQuery.Generated.cs index 93bf7c0af..e5e7ee622 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/ManagementUnitServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class ManagementUnitQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class ManagementUnitQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public ManagementUnitQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/PrincipalServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/PrincipalServiceQuery.Generated.cs index 0b09241bf..4e94d1311 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/PrincipalServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/PrincipalServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class PrincipalQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class PrincipalQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public PrincipalQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjContainerServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjContainerServiceQuery.Generated.cs index 6f6ab56d7..414046e65 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjContainerServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjContainerServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class SqlParserTestObjContainerQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SqlParserTestObjContainerQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SqlParserTestObjContainerQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjServiceQuery.Generated.cs index cebe38050..66227ca5f 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/SqlParserTestObjServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class SqlParserTestObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class SqlParserTestObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public SqlParserTestObjQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestCustomContextSecurityObjServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestCustomContextSecurityObjServiceQuery.Generated.cs index e6cb0e840..b130d42f2 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestCustomContextSecurityObjServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestCustomContextSecurityObjServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestCustomContextSecurityObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestCustomContextSecurityObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestCustomContextSecurityObjQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestImmutableObjServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestImmutableObjServiceQuery.Generated.cs index 552bfadc7..67bbc4861 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestImmutableObjServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestImmutableObjServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestImmutableObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestImmutableObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestImmutableObjQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPerformanceObjectServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPerformanceObjectServiceQuery.Generated.cs index 09c9bf7b1..de3f00fd1 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPerformanceObjectServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPerformanceObjectServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestPerformanceObjectQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestPerformanceObjectQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestPerformanceObjectQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPlainAuthObjectServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPlainAuthObjectServiceQuery.Generated.cs index 7621d2f4e..c53e3c151 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPlainAuthObjectServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestPlainAuthObjectServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestPlainAuthObjectQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestPlainAuthObjectQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestPlainAuthObjectQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestRootSecurityObjServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestRootSecurityObjServiceQuery.Generated.cs index e009dabe3..cdc8ff011 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestRootSecurityObjServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestRootSecurityObjServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestRootSecurityObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestRootSecurityObjQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestRootSecurityObjQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecurityObjItemServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecurityObjItemServiceQuery.Generated.cs index 7330a7be6..9e42ef046 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecurityObjItemServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecurityObjItemServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestSecurityObjItemQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecurityObjItemQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecurityObjItemQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem2ServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem2ServiceQuery.Generated.cs index 18c051036..d3efe49eb 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem2ServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem2ServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItem2QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItem2QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItem2QueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem3ServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem3ServiceQuery.Generated.cs index eee13171d..6bbe2b7da 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem3ServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItem3ServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItem3QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItem3QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItem3QueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItemServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItemServiceQuery.Generated.cs index 397bf5748..bed1f3dfc 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItemServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/TestSecuritySubObjItemServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class TestSecuritySubObjItemQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class TestSecuritySubObjItemQueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public TestSecuritySubObjItemQueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/WorkingCalendar1676ServiceQuery.Generated.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/WorkingCalendar1676ServiceQuery.Generated.cs index b0da0b13e..69ea07b0e 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/WorkingCalendar1676ServiceQuery.Generated.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Controllers/_Generated/MainQuery/WorkingCalendar1676ServiceQuery.Generated.cs @@ -6,14 +6,9 @@ [Microsoft.AspNetCore.Mvc.ApiControllerAttribute()] [Microsoft.AspNetCore.Mvc.ApiVersionAttribute("1.0")] [Microsoft.AspNetCore.Mvc.RouteAttribute("mainQueryApi/v{version:apiVersion}/[controller]")] - public partial class WorkingCalendar1676QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase, SampleSystem.BLL.ISampleSystemBLLContext, Framework.DomainDriven.ServiceModel.Service.EvaluatedData> + public partial class WorkingCalendar1676QueryController : Framework.DomainDriven.WebApiNetCore.ApiControllerBase> { - public WorkingCalendar1676QueryController(Framework.DomainDriven.ServiceModel.Service.IServiceEnvironment serviceEnvironment, Framework.Exceptions.IExceptionProcessor exceptionProcessor) : - base(serviceEnvironment, exceptionProcessor) - { - } - protected override Framework.DomainDriven.ServiceModel.Service.EvaluatedData GetEvaluatedData(Framework.DomainDriven.BLL.IDBSession session, SampleSystem.BLL.ISampleSystemBLLContext context) { return new Framework.DomainDriven.ServiceModel.Service.EvaluatedData(session, context, new SampleSystemServerPrimitiveDTOMappingService(context)); diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/CustomReports/SampleSystemCustomReportsServiceEnvironment.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/CustomReports/SampleSystemCustomReportsServiceEnvironment.cs index 21cf66afa..f374da719 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Env/CustomReports/SampleSystemCustomReportsServiceEnvironment.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/CustomReports/SampleSystemCustomReportsServiceEnvironment.cs @@ -1,36 +1,23 @@ -using System; - -using Framework.Core; - -using SampleSystem.BLL; +using SampleSystem.BLL; using SampleSystem.CustomReports.BLL; using SampleSystem.Domain; -using SampleSystem.ServiceEnvironment; + using Framework.CustomReports.Domain; using Framework.CustomReports.WebApi; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.SerializeMetadata; using SampleSystem.CustomReports.Employee; namespace SampleSystem.WebApiCore.CustomReports { - public class SampleSystemCustomReportsServiceEnvironment : ReportDefinitionServiceEnvironment, - ISecurityOperationCodeProviderContainer + public class SampleSystemCustomReportsServiceEnvironment : ReportDefinitionServiceEnvironment { - private static SampleSystemServiceEnvironment env; - - private static readonly Lazy CurrentLazy = LazyHelper.Create( - () => new SampleSystemCustomReportsServiceEnvironment(env)); - - - private readonly SecurityOperationCodeProvider securityOperationCodeProvider = new SecurityOperationCodeProvider(); - public SampleSystemCustomReportsServiceEnvironment(SampleSystemServiceEnvironment serviceEnvironment) : base(serviceEnvironment, new CustomReportAssembly().WithDomainAssembly(typeof(EmployeeReport).Assembly).WithBLLAssembly(typeof(EmployeeReportBLL).Assembly)) + public SampleSystemCustomReportsServiceEnvironment( + ISystemMetadataTypeBuilder systemMetadataTypeBuilder, + IContextEvaluator contextEvaluator) : + base(systemMetadataTypeBuilder, contextEvaluator, new CustomReportAssembly().WithDomainAssembly(typeof(EmployeeReport).Assembly).WithBLLAssembly(typeof(EmployeeReportBLL).Assembly)) { - env = serviceEnvironment; } - - public static SampleSystemCustomReportsServiceEnvironment Current => CurrentLazy.Value; - - public ISecurityOperationCodeProvider SecurityOperationCodeProvider => this.securityOperationCodeProvider; } } diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/Database/SampleSystemNHibSessionFactory.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/Database/SampleSystemNHibSessionFactory.cs index 9df81a057..886f526ce 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Env/Database/SampleSystemNHibSessionFactory.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/Database/SampleSystemNHibSessionFactory.cs @@ -1,25 +1,25 @@ #nullable enable + using System.Collections.Generic; using System.Data; using Framework.Cap.Abstractions; -using Framework.Core.Services; -using Framework.DomainDriven; using Framework.DomainDriven.NHibernate; +using Framework.DomainDriven.NHibernate.Audit; namespace SampleSystem.WebApiCore.Env.Database; -public class SampleSystemNHibSessionFactory : NHibSessionFactory +public class SampleSystemNHibSessionEnvironment : NHibSessionEnvironment { private readonly ICapTransactionManager manager; - public SampleSystemNHibSessionFactory( + public SampleSystemNHibSessionEnvironment( NHibConnectionSettings connectionSettings, - IUserAuthenticationService userAuthenticationService, IEnumerable mappingSettings, - IDateTimeService dateTimeService, - ICapTransactionManager manager) - : base(connectionSettings, mappingSettings, userAuthenticationService, dateTimeService) => + IAuditRevisionUserAuthenticationService auditRevisionUserAuthenticationService, + ICapTransactionManager manager, + INHibSessionEnvironmentSettings settings) + : base(connectionSettings, mappingSettings, auditRevisionUserAuthenticationService, settings) => this.manager = manager; public override void ProcessTransaction(IDbTransaction dbTransaction) diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/DomainDefaultUserAuthenticationService.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/DomainDefaultUserAuthenticationService.cs new file mode 100644 index 000000000..667075aea --- /dev/null +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/DomainDefaultUserAuthenticationService.cs @@ -0,0 +1,6 @@ +namespace SampleSystem.WebApiCore.Env; + +public class DomainDefaultUserAuthenticationService : IDefaultUserAuthenticationService +{ + public virtual string GetUserName() => $"{System.Environment.UserDomainName}\\{System.Environment.UserName}"; +} diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/EnvironmentExtensions.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/EnvironmentExtensions.cs index b39f78c1c..6f799728f 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Env/EnvironmentExtensions.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/EnvironmentExtensions.cs @@ -1,19 +1,21 @@ using System; -using Framework.Authorization.ApproveWorkflow; using Framework.Authorization.BLL; using Framework.Authorization.Generated.DAL.NHibernate; using Framework.Cap; -using Framework.Configuration.BLL; using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; using Framework.Configuration.Generated.DAL.NHibernate; using Framework.Core.Services; +using Framework.CustomReports.Domain; +using Framework.CustomReports.Services; using Framework.DependencyInjection; using Framework.DomainDriven; using Framework.DomainDriven.BLL; using Framework.DomainDriven.NHibernate; +using Framework.DomainDriven.NHibernate.Audit; +using Framework.DomainDriven.Serialization; +using Framework.DomainDriven.SerializeMetadata; using Framework.DomainDriven.ServiceModel.IAD; -using Framework.DomainDriven.ServiceModel.Service; using Framework.DomainDriven.WebApiNetCore; using Framework.Exceptions; @@ -26,15 +28,13 @@ using nuSpec.NHibernate; using SampleSystem.BLL; +using SampleSystem.Domain; using SampleSystem.Generated.DAL.NHibernate; using SampleSystem.ServiceEnvironment; using SampleSystem.WebApiCore.CustomReports; +using SampleSystem.WebApiCore.Env; using SampleSystem.WebApiCore.Env.Database; -using WorkflowCore.Interface; - -using UserAuthenticationService = SampleSystem.WebApiCore.Env.UserAuthenticationService; - namespace SampleSystem.WebApiCore { public static class EnvironmentExtensions @@ -43,32 +43,48 @@ public static IServiceCollection AddEnvironment(this IServiceCollection services { var connectionString = configuration.GetConnectionString("DefaultConnection"); - services - .AddHttpContextAccessor(); + services.AddHttpContextAccessor(); services.AddDatabaseSettings(connectionString); services.AddCapBss(connectionString); // Notifications - services - .AddSingleton(); - services.RegisterMessageSenderDependencies(configuration); + services.AddSingleton(); + services.RegisterMessageSenderDependencies(configuration); services.RegisterRewriteReceiversDependencies(configuration); // Others services.AddSingleton(DateTimeService.Default); - services.AddSingleton(); + + services.AddSingleton(); + services.AddSingletonFrom(); + services.AddSingletonFrom(); + + services.AddScoped(); + services.AddScopedFrom(); + services.AddScopedFrom(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingletonFrom(); + - return services.AddSingleton() - .AddControllerEnvironment(); + services.AddSingleton(new SubscriptionMetadataStore(new SampleSystemSubscriptionsMetadataFinder())); + + return services.AddControllerEnvironment(); } public static IServiceCollection AddDatabaseSettings(this IServiceCollection services, string connectionString) => - services - .AddSingleton() + services.AddScoped() + + .AddScoped() + .AddScopedFromLazy() + + .AddSingleton() .AddSingleton() + .AddSingleton() + .AddSingleton(AuthorizationMappingSettings.CreateDefaultAudit(string.Empty)) .AddSingleton(ConfigurationMappingSettings.CreateDefaultAudit(string.Empty)) .AddSingleton( @@ -78,17 +94,16 @@ public static IServiceCollection AddDatabaseSettings(this IServiceCollection ser public static IServiceCollection AddControllerEnvironment(this IServiceCollection services) { - services.AddSingleton, ISampleSystemBLLContext>>(); + services.AddSingleton>(); + services.AddSingleton, ReportParameterValueService>(); + services.AddSingleton(new SystemMetadataTypeBuilder(DTORole.All, typeof(PersistentDomainObjectBase).Assembly)); services.AddSingleton(); + services.AddSingleton(sp => sp.GetRequiredService().ReportService); + services.AddSingleton, SecurityOperationCodeProvider>(); - // Environment - services - .AddSingleton>(x => x.GetRequiredService()) - .AddSingleton>(x => x.GetRequiredService()) - .AddSingleton>(x => x.GetRequiredService()); - - services.AddScoped, ScopedContextEvaluator>(); + services.AddSingleton, ContextEvaluator>(); + services.AddSingleton, ContextEvaluator>(); return services; } diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/IDefaultUserAuthenticationService.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/IDefaultUserAuthenticationService.cs new file mode 100644 index 000000000..f7f073349 --- /dev/null +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/IDefaultUserAuthenticationService.cs @@ -0,0 +1,7 @@ +using Framework.Core.Services; + +namespace SampleSystem.WebApiCore.Env; + +public interface IDefaultUserAuthenticationService : IUserAuthenticationService +{ +} diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/SampleSystemDefaultUserAuthenticationService.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/SampleSystemDefaultUserAuthenticationService.cs new file mode 100644 index 000000000..cf2f31dbe --- /dev/null +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/SampleSystemDefaultUserAuthenticationService.cs @@ -0,0 +1,17 @@ +using Framework.Core.Services; +using Framework.DomainDriven.NHibernate.Audit; + +using Microsoft.AspNetCore.Http; + +namespace SampleSystem.WebApiCore.Env +{ + public class SampleSystemDefaultUserAuthenticationService : DomainDefaultUserAuthenticationService, IAuditRevisionUserAuthenticationService + { + + private readonly IHttpContextAccessor httpContextAccessor; + + public SampleSystemDefaultUserAuthenticationService(IHttpContextAccessor httpContextAccessor) => this.httpContextAccessor = httpContextAccessor; + + public override string GetUserName() => this.httpContextAccessor.HttpContext?.User?.Identity?.Name ?? base.GetUserName(); + } +} diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/SampleSystemUserAuthenticationService.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/SampleSystemUserAuthenticationService.cs new file mode 100644 index 000000000..3881a71b5 --- /dev/null +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Env/SampleSystemUserAuthenticationService.cs @@ -0,0 +1,39 @@ +using System; +using System.Threading.Tasks; + +using Framework.Core.Services; +using Framework.DomainDriven.ServiceModel.IAD; + +using SampleSystem.WebApiCore.Env; + +namespace SampleSystem.WebApiCore; + +public class SampleSystemUserAuthenticationService : IUserAuthenticationService, IImpersonateService +{ + private readonly IDefaultUserAuthenticationService defaultAuthenticationService; + + public SampleSystemUserAuthenticationService(IDefaultUserAuthenticationService defaultAuthenticationService) + { + this.defaultAuthenticationService = defaultAuthenticationService; + } + + public string GetUserName() => this.CustomUserName ?? this.defaultAuthenticationService.GetUserName(); + + public string CustomUserName { get; private set; } + + public async Task WithImpersonateAsync(string customUserName, Func> func) + { + var prev = this.CustomUserName; + + this.CustomUserName = customUserName; + + try + { + return await func(); + } + finally + { + this.CustomUserName = prev; + } + } +} diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Env/UserAuthenticationService.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Env/UserAuthenticationService.cs deleted file mode 100644 index 4dc2500b7..000000000 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Env/UserAuthenticationService.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Transactions; - -using Framework.Core.Services; - -using Microsoft.AspNetCore.Http; - -namespace SampleSystem.WebApiCore.Env -{ - public class UserAuthenticationService : IUserAuthenticationService - { - private readonly IHttpContextAccessor httpContextAccessor; - - public UserAuthenticationService(IHttpContextAccessor httpContextAccessor) => this.httpContextAccessor = httpContextAccessor; - - public string GetUserName() => CurrentUser; - - public static string CurrentUser { get; } = $"{System.Environment.UserDomainName}\\{System.Environment.UserName}"; - } -} diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ApiControllerExtensions.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ApiControllerExtensions.cs index 26699c699..e2c3e617c 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ApiControllerExtensions.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ApiControllerExtensions.cs @@ -14,7 +14,7 @@ namespace SampleSystem.WebApiCore.Controllers.CustomReport public static class ApiControllerExtensions { public static FileStreamResult GetReportResult( - this ApiControllerBase, ISampleSystemBLLContext, EvaluatedData> + this ApiControllerBase> controller, IReportStream result) { diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ServiceCollectionExtensions.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ServiceCollectionExtensions.cs index 050ad0037..9f970897b 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ServiceCollectionExtensions.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Extensions/ServiceCollectionExtensions.cs @@ -1,9 +1,24 @@ using System; - +using System.Collections.Generic; + +using Framework.Authorization.BLL; +using Framework.Authorization.Events; +using Framework.Authorization.Generated.DTO; +using Framework.Configuration.BLL; +using Framework.Configuration.BLL.Notification; +using Framework.Configuration.Generated.DTO; using Framework.Core; -using Framework.DomainDriven.ServiceModel; +using Framework.DomainDriven; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.NHibernate; using Framework.DomainDriven.ServiceModel.IAD; +using Framework.DomainDriven.ServiceModel.Service; +using Framework.Events; +using Framework.HierarchicalExpand; +using Framework.QueryableSource; +using Framework.Security.Cryptography; using Framework.SecuritySystem; +using Framework.SecuritySystem.Rules.Builders; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -12,6 +27,9 @@ using SampleSystem.BLL.Core.Jobs; using SampleSystem.BLL.Jobs; using SampleSystem.Domain; +using SampleSystem.Events; +using SampleSystem.Generated.DTO; +using SampleSystem.ServiceEnvironment; namespace SampleSystem.WebApiCore; @@ -19,39 +37,107 @@ public static class ServiceCollectionExtensions { public static IServiceCollection RegisterLegacyBLLContext(this IServiceCollection services) { - services.RegisterEvaluateScopeManager(); + services.AddScoped(); + services.AddScoped(sp => sp.GetRequiredService().Create(TargetSystemHelper.AuthorizationName)); + services.AddScoped(sp => sp.GetRequiredService().Create(TargetSystemHelper.ConfigurationName)); + services.AddScoped(sp => sp.GetRequiredService().Create(tss => tss.IsMain)); + + services.AddSingleton(); + + services.AddScoped>(); + services.AddScoped(); + services.AddScoped(); + + services.AddScoped(); + + services.AddScopedFrom(); + services.AddScopedFrom, DefaultAuthDALListener>(); + + services.AddScoped>(); + services.AddScoped(); + + services.AddScoped>(); + services.AddScoped(); + + services.AddScoped>(); + services.AddScoped(); + + services.AddScoped, OperationEventSenderContainer>(); + + services.AddScoped>, SampleSystemLocalDBEventMessageSender>(); + services.AddScoped, SampleSystemEventsSubscriptionManager>(); + + services.AddScoped, AuthorizationEventsSubscriptionManager>(); + services.AddScoped>, AuthorizationLocalDBEventMessageSender>(); + + services.AddScoped(); + services.AddScoped, SampleSystemAribaEventsSubscriptionManager>(); + + + services.AddSingleton(AvailableValuesHelper.AvailableValues.ToValidation()); + + services.AddSingleton(new DefaultMailSenderContainer("SampleSystem_Sender@luxoft.com")); + + services.AddScoped>(sp => sp.GetRequiredService().Create()); + + services.RegisterHierarchicalObjectExpander(); + + services.RegisterAdditonalAuthorizationBLL(); + + + services.RegisterGenericServices(); services.RegisterAuthorizationSystem(); services.RegisterAuthorizationBLL(); services.RegisterConfigurationBLL(); services.RegisterMainBLL(); + services.AddScoped(); + return services; } + public static IServiceCollection RegisterHierarchicalObjectExpander(this IServiceCollection services) + { + return services.AddSingleton() + .AddScoped, HierarchicalObjectExpanderFactory>(); + } + public static IServiceCollection RegisterAdditonalAuthorizationBLL(this IServiceCollection services) + { + return services.AddScopedFrom() + .AddScoped>(); + } public static IServiceCollection RegisterMainBLL(this IServiceCollection services) { return services - .AddScopedTransientByContainer(c => c.MainContext) - .AddScopedTransientByContainer>(c => c.MainContext) - .AddScopedTransientByContainer>(c => c.MainContext.SecurityService) - .AddScopedTransientByContainer(c => c.MainContext.SecurityService) - .AddScopedTransientByContainer(c => c.MainContext.GetQueryableSource()) - .AddScopedTransientByContainer(c => c.MainContext.SecurityExpressionBuilderFactory) + .AddScoped(sp => sp.GetRequiredService().GetDALFactory()) - .AddScoped, AccessDeniedExceptionService>() - .Self(SampleSystemSecurityServiceBase.Register) - .Self(SampleSystemBLLFactoryContainer.RegisterBLLFactory); - } + .AddScoped>() - public static IServiceCollection AddScopedTransientByContainer(this IServiceCollection services, Func, T> func) - where T : class - { - return services.AddScopedTransientFactory(sp => sp.GetRequiredService>() - .Pipe(manager => FuncHelper.Create(() => func(manager.CurrentBLLContextContainer)))); + .AddSingleton() + + .AddScoped(sp => + new SampleSystemValidator(sp.GetRequiredService(), sp.GetRequiredService())) + + .AddSingleton(new SampleSystemMainFetchService().WithCompress().WithCache().WithLock().Add(FetchService.OData)) + .AddScoped() + .AddScoped() + .AddSingleton, CryptService>() + .AddScoped(_ => new SampleSystemBLLContextSettings { TypeResolver = new[] { new SampleSystemBLLContextSettings().TypeResolver, TypeSource.FromSample().ToDefaultTypeResolver() }.ToComposite() }) + .AddScopedFromLazyInterfaceImplement() + + .AddScopedFrom, ISampleSystemBLLContext>() + .AddScopedFrom, ISampleSystemSecurityService>() + .AddScopedFrom() + .AddScoped, BLLQueryableSource>() + .AddScoped, Framework.SecuritySystem.Rules.Builders.MaterializedPermissions.SecurityExpressionBuilderFactory>() + .AddScoped, AccessDeniedExceptionService>() + + .Self(SampleSystemSecurityServiceBase.Register) + .Self(SampleSystemBLLFactoryContainer.RegisterBLLFactory); } public static IServiceCollection RegisterDependencyInjections(this IServiceCollection services, IConfiguration configuration) diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/SampleSystem.WebApiCore.csproj b/src/_SampleSystem/SampleSystem.WebApiCore/SampleSystem.WebApiCore.csproj index 221aa38ce..574b0cddb 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/SampleSystem.WebApiCore.csproj +++ b/src/_SampleSystem/SampleSystem.WebApiCore/SampleSystem.WebApiCore.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/_SampleSystem/SampleSystem.WebApiCore/Startup.cs b/src/_SampleSystem/SampleSystem.WebApiCore/Startup.cs index 6721fc8ac..ad3846d61 100644 --- a/src/_SampleSystem/SampleSystem.WebApiCore/Startup.cs +++ b/src/_SampleSystem/SampleSystem.WebApiCore/Startup.cs @@ -8,6 +8,8 @@ using Framework.Authorization.ApproveWorkflow; using Framework.Core; using Framework.DependencyInjection; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.WebApiNetCore; using Framework.WebApi.Utils; using MediatR; @@ -97,6 +99,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVers app .UseDefaultExceptionsHandling() .UseCorrelationId("SampleSystem_{0}") + .UseTryProcessDbSession() .UseHttpsRedirection() .UseRouting() @@ -118,14 +121,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVers private void UseHangfireBss(IApplicationBuilder app) { - var environment = LazyHelper.Create( + var contextEvaluator = LazyInterfaceImplementHelper.CreateProxy( () => { var serviceProvider = new ServiceCollection() .AddEnvironment(this.Configuration) .BuildServiceProvider(); - return serviceProvider.GetRequiredService(); + return serviceProvider.GetRequiredService>(); }); app.UseHangfireBss( @@ -134,7 +137,7 @@ private void UseHangfireBss(IApplicationBuilder app) { JobList.RunAll(z); }, - authorizationFilter: new SampleSystemHangfireAuthorization(environment)); + authorizationFilter: new SampleSystemHangfireAuthorization(contextEvaluator)); } } } diff --git a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/AuthTests.cs b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/AuthTests.cs index cbcbc6b70..08a6bb4b5 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/AuthTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/AuthTests.cs @@ -1,28 +1,26 @@ using System; using System.Linq; +using Framework.Authorization.BLL; using Framework.Authorization.Domain; using Framework.Core; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.BLL.Security; -using Framework.DomainDriven.ServiceModel.IAD; -using Framework.DomainDriven.ServiceModel.Service; -using Framework.Security; using Framework.SecuritySystem; -using Framework.Transfering; +using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; using SampleSystem.Domain.Projections; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests; using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.WebApiCore.Controllers.Main; namespace SampleSystem.BLL.Test { [TestClass] - public class AuthTests + public class AuthTests : TestBase { [TestMethod] public void TestGetProjectionViewOperationByMode() @@ -35,7 +33,7 @@ public void TestGetProjectionViewOperationByMode() [TestMethod] public void TestExtractQueryableFromSecPath() { - TestServiceEnvironment.Default.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var bll = context.Logics.BusinessUnitHrDepartmentFactory.Create(BLLSecurityMode.View); @@ -48,9 +46,9 @@ public void TestExtractQueryableFromSecPath() [TestMethod] public void TestPermissionDuplicates() { - IAuthorizationServiceEnvironment environment = TestServiceEnvironment.Default; + var contextEvaluator = this.RootServiceProvider.GetRequiredService>(); - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + contextEvaluator.Evaluate(DBSessionMode.Write, context => { var entity = context.Logics.PermissionFilterEntity.GetObjectBy(fe => fe.EntityId == new Guid("38BFD64B-9268-464E-A8AB-0276BBEB1631")); @@ -74,9 +72,7 @@ public void TestPermissionDuplicates() [TestMethod] public void TestLoadBY() { - var environment = TestServiceEnvironment.Default; - - environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, "Tester01", context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Read, "Tester01", context => { var tree = context.Logics.TestBusinessUnitFactory.Create(BLLSecurityMode.View).GetTree(); @@ -87,9 +83,7 @@ public void TestLoadBY() [TestMethod] public void TestLoadProjections() { - var environment = TestServiceEnvironment.Default; - - var facade = environment.ServiceProvider.GetDefaultControllerEvaluator("Tester01"); + var facade = this.RootServiceProvider.GetDefaultControllerEvaluator("Tester01"); var res1 = facade.Evaluate(c => c.GetTestDepartmentsByOperation(SampleSystemHRDepartmentSecurityOperationCode.EmployeeEdit)); @@ -101,9 +95,7 @@ public void TestLoadProjections() [TestMethod] public void TestConvertSecurityPath() { - var environment = TestServiceEnvironment.Default; - - environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, "Tester01", (ISampleSystemBLLContext context) => + this.GetContextEvaluator().Evaluate(DBSessionMode.Read, "Tester01", (ISampleSystemBLLContext context) => { var employees = context.Logics.TestEmployee.GetFullList(); @@ -131,9 +123,7 @@ public void TestConvertSecurityPath() [TestMethod] public void ClearAuthDB() { - var environment = TestServiceEnvironment.Default; - - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { context.Authorization.Logics.Default.Create().Remove(context.Authorization.Logics.Principal.GetFullList()); @@ -148,9 +138,7 @@ public void ClearAuthDB() [TestMethod] public void AddEntityTypes() { - var environment = TestServiceEnvironment.Default; - - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { context.Authorization.Logics.EntityType.Register(new[] { typeof(BusinessUnit).Assembly }); @@ -161,9 +149,7 @@ public void AddEntityTypes() [TestMethod] public void AddSelfAdminPermissions() { - var environment = TestServiceEnvironment.Default; - - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var adminRole = context.Authorization.Logics.BusinessRole.GetOrCreateAdminRole(); @@ -181,13 +167,11 @@ public void AddSelfAdminPermissions() [TestMethod] public void TestRemoveWithDelegate() { - var environment = TestServiceEnvironment.Default; - var principalName = "TestDelegateUser"; var roleName = "TestDelegateRole"; - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, (context, session) => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, (context, session) => { var testRole = context.Authorization.Logics.BusinessRole.GetByNameOrCreate(roleName, true); @@ -206,7 +190,7 @@ public void TestRemoveWithDelegate() } }); - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var testPrincipal = context.Authorization.Logics.Principal.GetByName(principalName, true); diff --git a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/ConfigurationTests.cs b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/ConfigurationTests.cs index 83cd4b2a8..bac91c645 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/ConfigurationTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/ConfigurationTests.cs @@ -1,32 +1,26 @@ using System; using System.Linq; -using Configuration.WebApi.Controllers; - -using Framework.Authorization.Domain; using Framework.Configuration.Generated.DTO; using Framework.Core; using Framework.DomainDriven.BLL; -using Framework.DomainDriven.ServiceModel.IAD; -using Framework.DomainDriven.ServiceModel.Service; using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests; using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.WebApiCore.Controllers; namespace SampleSystem.BLL.Test { [TestClass] - public class ConfigurationTests + public class ConfigurationTests : TestBase { [TestMethod] public void TestCreateModification() { - var environment = TestServiceEnvironment.Default; - - environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var empl = context.Logics.Employee.GetUnsecureQueryable().FirstOrDefault(); @@ -41,9 +35,7 @@ public void TestCreateModification() [TestMethod] public void TestForceSendEvent() { - var environment = TestServiceEnvironment.Default; - - var configFacade = environment.ServiceProvider.GetDefaultControllerEvaluator(); + var configFacade = this.RootServiceProvider.GetDefaultControllerEvaluator(); //var mainFacade = new Facade(environment); diff --git a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/SampleSystem.BLL.Test.csproj b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/SampleSystem.BLL.Test.csproj index b9048de28..11158628b 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/SampleSystem.BLL.Test.csproj +++ b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/SampleSystem.BLL.Test.csproj @@ -3,10 +3,10 @@ false - + - - + + diff --git a/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/TestBase.cs b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/TestBase.cs new file mode 100644 index 000000000..0d7b0ff46 --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.BLL.Test/TestBase.cs @@ -0,0 +1,11 @@ +using System; + +using SampleSystem.IntegrationTests; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; + +namespace SampleSystem.BLL.Test; + +public abstract class TestBase : IRootServiceProviderContainer +{ + public IServiceProvider RootServiceProvider { get; } = SampleSystemTestRootServiceProvider.Default; +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.CheckGenTests/SampleSystem.CheckGenTests.csproj b/src/_SampleSystem/_Tests/SampleSystem.CheckGenTests/SampleSystem.CheckGenTests.csproj index 1642e34e0..9c3db523a 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.CheckGenTests/SampleSystem.CheckGenTests.csproj +++ b/src/_SampleSystem/_Tests/SampleSystem.CheckGenTests/SampleSystem.CheckGenTests.csproj @@ -3,10 +3,10 @@ false - - - - + + + + diff --git a/src/_SampleSystem/_Tests/SampleSystem.CodeGenerate/SampleSystem.CodeGenerate.csproj b/src/_SampleSystem/_Tests/SampleSystem.CodeGenerate/SampleSystem.CodeGenerate.csproj index dd3e11b14..dee08d8aa 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.CodeGenerate/SampleSystem.CodeGenerate.csproj +++ b/src/_SampleSystem/_Tests/SampleSystem.CodeGenerate/SampleSystem.CodeGenerate.csproj @@ -3,10 +3,10 @@ false - - - - + + + + diff --git a/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/SampleSystem.DbGenerate.csproj b/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/SampleSystem.DbGenerate.csproj index 0969bcb8b..111d07fe9 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/SampleSystem.DbGenerate.csproj +++ b/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/SampleSystem.DbGenerate.csproj @@ -5,10 +5,10 @@ SampleSystem.DbGenerate.Program - - - - + + + + diff --git a/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/UseSchemeUpdateTest.cs b/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/UseSchemeUpdateTest.cs index d8f4281b4..ae163a5d6 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/UseSchemeUpdateTest.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.DbGenerate/UseSchemeUpdateTest.cs @@ -3,10 +3,12 @@ using System.Linq; using Framework.Cap.Abstractions; +using Framework.Core; using Framework.Core.Services; using Framework.DomainDriven; using Framework.DomainDriven.BLL; using Framework.DomainDriven.NHibernate; +using Framework.DomainDriven.NHibernate.Audit; using Microsoft.Data.SqlClient; using Microsoft.Extensions.DependencyInjection; @@ -52,12 +54,11 @@ private static void RunSchemeUpdate(string connectionString) services.AddDatabaseSettings(connectionString); - services.AddSingleton(DateTimeService.Default); - services.AddSingleton(UserAuthenticationService.CreateFor("neg")); + services.AddSingleton(_ => LazyInterfaceImplementHelper.CreateNotImplemented()); services.AddSingleton(); var provider = services.BuildServiceProvider(false); - var dbSessionFactory = (NHibSessionFactory) provider.GetService(); + var dbSessionFactory = provider.GetService(); var cfg = dbSessionFactory?.Configuration; var migrate = new SchemaUpdate(cfg); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ApprovePermissionTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ApprovePermissionTests.cs index 27724a2fe..dedc0d2a9 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ApprovePermissionTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ApprovePermissionTests.cs @@ -110,7 +110,7 @@ public void SetUp() } })); - this.workflowManager = this.Environment.ServiceProvider.GetRequiredService(); + this.workflowManager = this.RootServiceProvider.GetRequiredService(); this.workflowManager.Start(); } @@ -129,6 +129,7 @@ public async Task CreatePermissionWithApprove_PermissionApproved() // Act var approvingPrincipal = this.CreateTestPermission(); + var permissionIdentity = approvingPrincipal.Permissions.Single().Identity; var startedWf = wfController.WithIntegrationImpersonate().Evaluate(c => c.StartJob()); @@ -146,7 +147,7 @@ public async Task CreatePermissionWithApprove_PermissionApproved() await wfController.EvaluateAsync(c => c.ApproveOperation(permissionIdentity, wfObj.ApproveEventId)); } - var wiStatus = this.Environment.ServiceProvider.GetRequiredService().WaitForWorkflowToComplete(rootInstanceId.ToString(), TimeSpan.FromSeconds(10)); + var wiStatus = this.RootServiceProvider.GetRequiredService().WaitForWorkflowToComplete(rootInstanceId.ToString(), TimeSpan.FromSeconds(10)); var postApprovePrincipal = this.authFacade.Evaluate(c => c.GetRichPrincipal(approvingPrincipal.Identity)); @@ -183,7 +184,7 @@ public async Task CreatePermissionWithApprove_PermissionRejected() await wfController.EvaluateAsync(c => c.RejectOperation(permissionIdentity, wfObj.RejectEventId)); } - var wiStatus = this.Environment.ServiceProvider.GetRequiredService().WaitForWorkflowToComplete(rootInstanceId.ToString(), TimeSpan.FromSeconds(10)); + var wiStatus = this.RootServiceProvider.GetRequiredService().WaitForWorkflowToComplete(rootInstanceId.ToString(), TimeSpan.FromSeconds(10)); var postApprovePrincipal = this.authFacade.Evaluate(c => c.GetRichPrincipal(approvingPrincipal.Identity)); @@ -210,7 +211,7 @@ public void CreatePermissionWithAutoApprove_PermissionApproved() Thread.Sleep(3000); - var wiStatus = this.Environment.ServiceProvider.GetRequiredService().WaitForWorkflowToComplete(rootInstanceId.ToString(), TimeSpan.FromSeconds(20)); + var wiStatus = this.RootServiceProvider.GetRequiredService().WaitForWorkflowToComplete(rootInstanceId.ToString(), TimeSpan.FromSeconds(20)); var postApprovePrincipal = this.authFacade.Evaluate(c => c.GetRichPrincipal(approvingPrincipal.Identity)); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AsyncControllerTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AsyncControllerTests.cs new file mode 100644 index 000000000..a05b805a4 --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AsyncControllerTests.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq; +using System.Threading.Tasks; + +using FluentAssertions; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.TestData; +using SampleSystem.WebApiCore.Controllers.Main; + +namespace SampleSystem.IntegrationTests; + +[TestClass] +public class AsyncControllerTests : TestBase +{ + [TestMethod] + public async Task TestSaveLocation() + { + // Arrange + var asyncControllerEvaluator = this.GetControllerEvaluator(); + + var saveDto = new LocationStrictDTO { Name = Guid.NewGuid().ToString(), CloseDate = 30, Code = 12345 }; + + // Act + var ident = await asyncControllerEvaluator.EvaluateAsync(c => c.AsyncSaveLocation(saveDto)); + + var loadedLocationList = await asyncControllerEvaluator.EvaluateAsync(c => c.AsyncGetLocations()); + + // Assert + var location = loadedLocationList.SingleOrDefault(bu => bu.Name == saveDto.Name && bu.Identity == ident); + + location.Should().NotBeNull(); + } +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AuthPerformanceTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AuthPerformanceTests.cs index 42a45d6b7..142f5026f 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AuthPerformanceTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/AuthPerformanceTests.cs @@ -12,6 +12,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.Main; diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BUProjectionTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BUProjectionTests.cs index b4431e879..1ce0d8da2 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BUProjectionTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BUProjectionTests.cs @@ -8,6 +8,7 @@ using SampleSystem.BLL; using SampleSystem.Domain; using SampleSystem.Domain.Inline; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.MainQuery; @@ -46,7 +47,7 @@ public void SetUp() var empId2 = this.DataHelper.SaveEmployee(login: TestEmployee1Login, coreBusinessUnit: costBuId, nameEng: new Fio { FirstName = "BB" }); var empId3 = this.DataHelper.SaveEmployee(login: TestEmployee2Login, coreBusinessUnit: profitBuId, nameEng: new Fio { FirstName = "CC" }); - this.DataHelper.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BusinessUnitTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BusinessUnitTests.cs index 40e1f7c8e..2139aa852 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BusinessUnitTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/BusinessUnitTests.cs @@ -12,6 +12,7 @@ using SampleSystem.Domain; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.IntegrationTests.__Support.Utils.Framework; using SampleSystem.WebApiCore.Controllers.Main; @@ -52,7 +53,7 @@ public void SetUp() type: buTypeId, parent: luxoftBuId); - this.DataHelper.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => { @@ -177,8 +178,7 @@ private void CreateBigBuTree() .EvaluateWrite( context => { - var period = new Period( - context.DateTimeService.CurrentFinancialYear.StartDate + var period = new Period(this.GetDateTimeService().CurrentFinancialYear.StartDate .AddYears(-1)); var accountType = context.Logics.BusinessUnitType.GetById(buAccountId.Id); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DenormalizeAuthTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DenormalizeAuthTests.cs deleted file mode 100644 index 73b5bc032..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DenormalizeAuthTests.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; - -using FluentAssertions; - -using Framework.Core; -using Framework.DomainDriven.BLL; -using Framework.HierarchicalExpand; -using Framework.SecuritySystem; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -using SampleSystem.BLL; -using SampleSystem.Domain; -using SampleSystem.Generated.DTO; -using SampleSystem.IntegrationTests.__Support.TestData; - -using BusinessRole = SampleSystem.IntegrationTests.__Support.Utils.BusinessRole; - -namespace SampleSystem.IntegrationTests -{ - [TestClass] - public class DenormalizeAuthTests : TestBase - { - private const string TestEmployeeLogin = "DS SecurityTester"; - - private LocationIdentityDTO loc1Ident; - - private BusinessUnitIdentityDTO bu1Ident; - - private ManagementUnitIdentityDTO mbu1Ident; - - private BusinessUnitIdentityDTO bu2Ident; - - - private TestPlainAuthObjectIdentityDTO testPlainAuthObjectIdent; - - - [TestInitialize] - public void SetUp() - { - - this.loc1Ident = this.DataHelper.SaveLocation(); - - this.bu1Ident = this.DataHelper.SaveBusinessUnit(); - - this.bu2Ident = this.DataHelper.SaveBusinessUnit(); - - this.mbu1Ident = this.DataHelper.SaveManagementUnit(); - - this.DataHelper.SaveEmployee(login: TestEmployeeLogin); - - this.AuthHelper.SetUserRole(TestEmployeeLogin, new SampleSystemPermission(BusinessRole.Administrator, this.bu1Ident, this.mbu1Ident, this.loc1Ident)); - - this.AuthHelper.SetUserRole(TestEmployeeLogin, new SampleSystemPermission(BusinessRole.Administrator, this.bu1Ident, null, this.loc1Ident)); - - this.EvaluateWrite( - context => - { - var sampleObj = new TestPlainAuthObject - { - Name = "obj1", - Location = context.Logics.Location.GetById(this.loc1Ident.Id, true), - }; - - new TestItemAuthObject(sampleObj) - { - BusinessUnit = context.Logics.BusinessUnit.GetById(this.bu1Ident.Id, true), - ManagementUnit = context.Logics.ManagementUnit.GetById(this.mbu1Ident.Id, true) - }; - - context.Logics.TestPlainAuthObject.Save(sampleObj); - - this.testPlainAuthObjectIdent = sampleObj.ToIdentityDTO(); - }); - - this.EvaluateWrite( - context => - { - var sampleObj = new TestPlainAuthObject - { - Name = "obj2", - Location = context.Logics.Location.GetById(this.loc1Ident.Id, true), - }; - - new TestItemAuthObject(sampleObj) - { - BusinessUnit = context.Logics.BusinessUnit.GetById(this.bu2Ident.Id, true), - ManagementUnit = context.Logics.ManagementUnit.GetById(this.mbu1Ident.Id, true) - }; - - context.Logics.TestPlainAuthObject.Save(sampleObj); - }); - } - - //[TestMethod] - //public void TestInlineEval_TestPassed() - //{ - // // Arrange - - // // Act - // var objIdents = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, TestEmployeeLogin, ctx => - // { - // var baseFilter = BuildTestPlainAuthObjectSecurityFilter(ctx, SampleSystemSecurityOperation.EmployeeView); - // var filter = baseFilter.ExpandConst().InlineEval(); - - // var objs = ctx.Logics.TestPlainAuthObject.GetUnsecureQueryable().Where(filter).ToList(); - - // return objs.ToList(obj => obj.ToIdentityDTO()); - // }); - - // // Assert - // objIdents.Count().Should().Be(1); - // objIdents[0].Should().Be(this.testPlainAuthObjectIdent); - //} - - //[TestMethod] - //public void AdminTestInlineEval_TestPassed() - //{ - // // Arrange - - // // Act - // var objIdents = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, ctx => - // { - // var baseFilter = BuildTestPlainAuthObjectSecurityFilter(ctx, SampleSystemSecurityOperation.EmployeeView); - // var filter = baseFilter.ExpandConst().InlineEval(); - - // var objs = ctx.Logics.TestPlainAuthObject.GetUnsecureQueryable().Where(filter).ToList(); - - // return objs.ToList(obj => obj.ToIdentityDTO()); - // }); - - // // Assert - // objIdents.Count().Should().Be(2); - //} - - //private static Expression> BuildTestPlainAuthObjectSecurityFilter(ISampleSystemBLLContext context, ContextSecurityOperation securityOperation) - //{ - // var authContext = context.Authorization; - - // var buFilter = BuildBuFilterExpression(context, securityOperation.SecurityExpandType); - - // // var employeeFilter = BuildEmployeeFilterExpression(context, securityOperation.SecurityExpandType); - - // return testPlainAuthObject => - // authContext.GetPermissionQuery(securityOperation) - // .Any(permission => - // permission.DenormalizedItems.Any(permissionFilterItem => - // buFilter.Eval(testPlainAuthObject, permission, permissionFilterItem) - // //&& employeeFilter.Eval(testPlainAuthObject, permission, permissionFilterItem) - // )); - - //} - - //private static Expression, IDenormalizedPermissionItem, bool>> BuildBuFilterExpression(ISampleSystemBLLContext context, HierarchicalExpandType expandType) - //{ - // var entityTypeId = context.Authorization.ResolveSecurityTypeId(typeof(BusinessUnit)); - - // var eqIdentsExpr = ExpressionHelper.GetEquality(); - - // var grandIdent = context.Authorization.GrandAccessIdent; - - // var expander = context.HierarchicalObjectExpanderFactory.CreateQuery(typeof(BusinessUnit)); - - // var expandExpression = expander.TryGetSingleExpandExpression(expandType); - - // var containsItem = (expandExpression == null - // ? ExpressionHelper.Create((Guid itemId, Guid permissionEntityId) => eqIdentsExpr.Eval(itemId, permissionEntityId)) - // : ExpressionHelper.Create((Guid itemId, Guid permissionEntityId) => expandExpression.Eval(permissionEntityId).Contains(itemId))) - // .ExpandConst() - // .InlineEval(); - - // Expression, IDenormalizedPermissionItem, bool>> baseFilter = (domainObject, _, denormalizedPermissionItem) => - - // eqIdentsExpr.Eval(denormalizedPermissionItem.EntityType.Id, entityTypeId) - - // && (eqIdentsExpr.Eval(denormalizedPermissionItem.EntityId, grandIdent) - - // || !domainObject.Items.Select(item => item.BusinessUnit).Any() - - // || domainObject.Items.Select(item => item.BusinessUnit).Any(item => containsItem.Eval(item.Id, denormalizedPermissionItem.EntityId))); - - // return baseFilter.ExpandConst().InlineEval(); - //} - - //private static Expression, IDenormalizedPermissionItem, bool>> BuildEmployeeFilterExpression(ISampleSystemBLLContext context, HierarchicalExpandType expandType) - //{ - // var entityTypeId = context.Authorization.ResolveSecurityTypeId(typeof(Employee)); - - // var eqIdentsExpr = ExpressionHelper.GetEquality(); - - // var getIdents = ExpressionHelper.Create((IPermission permission) => - // permission.DenormalizedItems - // .Where(item => eqIdentsExpr.Eval(item.EntityType.Id, entityTypeId)) - // .Select(pfe => pfe.EntityId)) - // .ExpandConst() - // .InlineEval(); - - // var grandIdent = context.Authorization.GrandAccessIdent; - - // var hasGrandAccess = ExpressionHelper.Create((IPermission permission) => getIdents.Eval(permission).Any(entityId => eqIdentsExpr.Eval(entityId, grandIdent))) - // .ExpandConst() - // .InlineEval(); - - // var expander = context.HierarchicalObjectExpanderFactory.CreateQuery(typeof(Employee)); - - // var expandExpression = expander.GetExpandExpression(expandType); - - // var expandExpressionQ = from idents in getIdents - // select expandExpression.Eval(idents); - - // return (domainObject, permission, denormalizedPermissionItem) => - - // hasGrandAccess.Eval(permission) - - // || domainObject.Employee == null - - // || expandExpressionQ.Eval(permission).Contains(domainObject.Employee.Id); - //} - } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DependencySecurityTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DependencySecurityTests.cs index 75a7e0282..b6c0d6d1c 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DependencySecurityTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/DependencySecurityTests.cs @@ -1,19 +1,13 @@ -using System; -using System.Linq; -using System.Linq.Expressions; +using System.Linq; +using System.Runtime.InteropServices.ComTypes; using FluentAssertions; -using Framework.Authorization.Domain; -using Framework.Core; -using Framework.DomainDriven.BLL; -using Framework.OData; - using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; -using SampleSystem.Domain.Inline; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.Main; diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeProjectionTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeProjectionTests.cs index 0ee701b5f..c82b49dfc 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeProjectionTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeProjectionTests.cs @@ -11,6 +11,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.MainQuery; @@ -51,7 +52,7 @@ public void SetUp() this.DataHelper.SaveEmployee(login: TestEmployee2Login, coreBusinessUnit: profitBuId); this.DataHelper.SaveEmployee(login: TestEmployee3Login, coreBusinessUnit: costBuId); - this.DataHelper.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeTests.cs index 3b847e5bb..ee2f319e4 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EmployeeTests.cs @@ -21,10 +21,13 @@ using Framework.Events; using Framework.OData; +using Microsoft.AspNetCore.Mvc; + using NHibernate.Event; using NHibernate.Impl; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.WebApiCore.Controllers.Main; namespace SampleSystem.IntegrationTests @@ -45,7 +48,7 @@ public void GetEmployeeFromDB_FilterByAge_ReturnNotNulRecords() CoreDatabaseUtil.ExecuteSql("INSERT INTO [app].[Employee] ([id], age) VALUES (NewId(), null)"); // Act, IntegrationNamespace - var actual = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, + var actual = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, ctx => ctx.Logics.Employee.GetUnsecureQueryable().Where(q => q.Age == 10).ToList()); // Assert @@ -313,7 +316,7 @@ public void ChangeEmployee_ContainsAribaEvent() [Ignore] public void EventListenerTest() { - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, (_, dbContext) => { var writeNhibSession = dbContext as WriteNHibSession; @@ -350,7 +353,7 @@ public void CreateEmployeeFilter_IsNotVirtual() var buIdentity = this.DataHelper.SaveBusinessUnit(); // Act - var isVirtualResult = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, ctx => + var isVirtualResult = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, ctx => { var filter = new TestEmployeeFilter { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EnversBug1676.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EnversBug1676.cs index 7c1dd72b0..cdeeb1217 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EnversBug1676.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/EnversBug1676.cs @@ -6,6 +6,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain.EnversBug1676; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; namespace SampleSystem.IntegrationTests diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExpandPathTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExpandPathTests.cs index 15f6198a4..32e928ba8 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExpandPathTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExpandPathTests.cs @@ -10,6 +10,8 @@ using Framework.DomainDriven.BLL; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; + namespace SampleSystem.IntegrationTests { [TestClass] @@ -24,7 +26,7 @@ public void LiftToNullableContainsExt_ShouldNotThrowException() // Act var action = new Action(() => { - var res = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.CoreBusinessUnit.Period.ContainsExt(period.EndDate ?? period.StartDate))); + var res = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.CoreBusinessUnit.Period.ContainsExt(period.EndDate ?? period.StartDate))); return; }); @@ -41,7 +43,7 @@ public void LiftToNullableBinaryExpression_ShouldNotThrowException() // Act var action = new Action(() => { - var res = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.LocationCode == null)); + var res = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.LocationCode == null)); return; }); @@ -58,7 +60,7 @@ public void LiftToNullablePeriodIntersect_ShouldNotThrowException() // Act var action = new Action(() => { - var res = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.CoreBusinessUnitPeriod.IsIntersected(this.DateTimeService.CurrentMonth))); + var res = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.CoreBusinessUnitPeriod.IsIntersected(this.DateTimeService.CurrentMonth))); return; }); @@ -76,7 +78,7 @@ public void LiftToNullablePeriodContains_ShouldNotThrowException() // Act var action = new Action(() => { - var res = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.CoreBusinessUnitPeriod.Contains((DateTime?)this.DateTimeService.Today))); + var res = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, context => context.Logics.Employee.GetListBy(employee => employee.CoreBusinessUnitPeriod.Contains((DateTime?)this.DateTimeService.Today))); return; }); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExtraQueryableSecurityPathTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExtraQueryableSecurityPathTests.cs index 3438d5686..8265b6671 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExtraQueryableSecurityPathTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ExtraQueryableSecurityPathTests.cs @@ -20,8 +20,7 @@ using SampleSystem.Generated.DTO; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.Domain.ManualProjections; - - +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using BusinessRole = SampleSystem.IntegrationTests.__Support.Utils.BusinessRole; @@ -86,7 +85,7 @@ public void TestExtraQueryableSecurityPath_LoadedWithExtraQueryableFilter() }); // Act - var items = this.Environment.GetContextEvaluator().Evaluate (DBSessionMode.Read, TestEmployeeLogin, context => + var items = this.GetContextEvaluator().Evaluate (DBSessionMode.Read, TestEmployeeLogin, context => { var employees = context.Logics.EmployeeFactory.Create(createProviderFunc(context)).GetSecureQueryable().ToList(); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/InformationTest.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/InformationTest.cs index a30ef01de..841b605ef 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/InformationTest.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/InformationTest.cs @@ -12,6 +12,7 @@ using Framework.DomainDriven.BLL; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; namespace SampleSystem.IntegrationTests { @@ -25,7 +26,7 @@ public void CreateAndRemoveInformation_ContainsIntegrationEvents() this.ClearIntegrationEvents(); // Act - var id = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + var id = this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var newObj = new Information() { Name = "ololo" }; @@ -34,7 +35,7 @@ public void CreateAndRemoveInformation_ContainsIntegrationEvents() return newObj.Id; }); - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var obj = context.Logics.Information.GetById(id, true); @@ -46,4 +47,4 @@ public void CreateAndRemoveInformation_ContainsIntegrationEvents() this.GetIntegrationEvents().Should().ContainSingle(dto => dto.Information.Id == id); } } -} \ No newline at end of file +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/IntegrationVersionTest.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/IntegrationVersionTest.cs index c66805d23..3fb8d5a21 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/IntegrationVersionTest.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/IntegrationVersionTest.cs @@ -6,6 +6,7 @@ using SampleSystem.Domain.IntergrationVersions; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.IntegrationTests.__Support.Utils; using SampleSystem.WebApiCore.Controllers.Integration; @@ -21,7 +22,7 @@ public void SaveWithMoreVersion_IgnoreLessPolicy_ValueSaved() //Arrange var integrationVersion = 10; - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer1() { @@ -51,7 +52,7 @@ public void SaveWithMoreVersion_IgnoreLessPolicy_ValueSaved() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(expectedName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -63,7 +64,7 @@ public void SaveWithLessVersion_IgnoreLessPolicy_ValueIgnore() var expectedIntegrationVersion = 10; var expectedName = Guid.NewGuid().ToString(); - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer1() { @@ -91,7 +92,7 @@ public void SaveWithLessVersion_IgnoreLessPolicy_ValueIgnore() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(expectedName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -103,7 +104,7 @@ public void SaveWithEqualVersion_IgnoreLessPolicy_ValueIgnored() var expectedIntegrationVersion = 10; var expectedName = Guid.NewGuid().ToString(); - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer1() { @@ -131,7 +132,7 @@ public void SaveWithEqualVersion_IgnoreLessPolicy_ValueIgnored() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(expectedName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -142,7 +143,7 @@ public void SaveWithMoreVersion_IgnoreLessOrEqualPolicy_ValueSaved() //Arrange var integrationVersion = 10; - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer2() { @@ -172,7 +173,7 @@ public void SaveWithMoreVersion_IgnoreLessOrEqualPolicy_ValueSaved() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(expectedName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -184,7 +185,7 @@ public void SaveWithLessVersion_IgnoreLessOrEqualPolicy_ValueIgnore() var expectedIntegrationVersion = 10; var expectedName = Guid.NewGuid().ToString(); - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer2() { @@ -212,7 +213,7 @@ public void SaveWithLessVersion_IgnoreLessOrEqualPolicy_ValueIgnore() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(expectedName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -224,7 +225,7 @@ public void SaveWithEqualVersion_IgnoreLessOrEqualPolicy_ValueIgnored() var expectedIntegrationVersion = 10; var expectedName = Guid.NewGuid().ToString(); - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer2() { @@ -254,7 +255,7 @@ public void SaveWithEqualVersion_IgnoreLessOrEqualPolicy_ValueIgnored() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(nextName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -266,7 +267,7 @@ public void SaveModelWithLessVersion_IgnoreLessOrEqualPolicy_ValueIgnore() var expectedIntegrationVersion = 10; var expectedName = Guid.NewGuid().ToString(); - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer1() { @@ -304,7 +305,7 @@ public void SaveModelWithLessVersion_IgnoreLessOrEqualPolicy_ValueIgnore() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(expectedName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion); } @@ -316,7 +317,7 @@ public void SaveModelWithEqualVersion_IgnoreLessOrEqualPolicy_ValueIgnored() var expectedIntegrationVersion = 10; var expectedName = Guid.NewGuid().ToString(); - var id = this.DataHelper.EvaluateWrite(context => + var id = this.EvaluateWrite(context => { var obj = new IntegrationVersionContainer1() { @@ -354,7 +355,7 @@ public void SaveModelWithEqualVersion_IgnoreLessOrEqualPolicy_ValueIgnored() // Assert - var actual = this.DataHelper.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); + var actual = this.EvaluateRead(context => context.Logics.Default.Create().GetById(id)); actual.Name.Should().Be(modelName); actual.IntegrationVersion.Should().Be(expectedIntegrationVersion + 1); } diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManagmentUnitFluentMappingTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManagmentUnitFluentMappingTests.cs index 402ba5911..dbf3e6aab 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManagmentUnitFluentMappingTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManagmentUnitFluentMappingTests.cs @@ -12,6 +12,7 @@ using SampleSystem.Domain; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.IntegrationTests.__Support.Utils.Framework; using SampleSystem.WebApiCore.Controllers.Main; @@ -33,8 +34,7 @@ public void CheckBusinessUnitSecondaryAccess_HasAccess() // Arrange var employeeId = this.DataHelper.SaveEmployee(); - this.Environment - .GetContextEvaluator() + this.GetContextEvaluator() .Evaluate( DBSessionMode.Write, (c) => @@ -53,8 +53,7 @@ public void CheckBusinessUnitSecondaryAccess_HasAccess() }); // Act - var r = this.Environment - .GetContextEvaluator() + var r = this.GetContextEvaluator() .Evaluate( DBSessionMode.Read, (c) => diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManualAndLegacyProjectionSecurityTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManualAndLegacyProjectionSecurityTests.cs index 97f65c914..a35533c00 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManualAndLegacyProjectionSecurityTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/ManualAndLegacyProjectionSecurityTests.cs @@ -18,6 +18,7 @@ using SampleSystem.Generated.DTO; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.Domain.ManualProjections; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.WebApiCore.Controllers.MainQuery; using BusinessRole = SampleSystem.IntegrationTests.__Support.Utils.BusinessRole; @@ -89,7 +90,7 @@ public void TestLegacyEmployeeProjection_AccessorsResolved() // Arrange // Act - var items = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, TestEmployeeLogin, ctx => + var items = this.GetContextEvaluator().Evaluate(DBSessionMode.Read, TestEmployeeLogin, ctx => { var bll = ctx.Logics.TestLegacyEmployeeFactory.Create(BLLSecurityMode.View); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/NotificationCountryTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/NotificationCountryTests.cs index 8a369a42b..1c1b29c4e 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/NotificationCountryTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/NotificationCountryTests.cs @@ -11,6 +11,7 @@ using SampleSystem.Domain; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.Main; @@ -27,7 +28,7 @@ public void CreateAndUpdateCountry_SingleModificationExists() // Act this.ClearModifications(); - var countryId = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + var countryId = this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var bll = context.Logics.Country; @@ -62,7 +63,7 @@ public void CreateAndRemoveCountry_ModificationNotExists() // Act this.ClearModifications(); - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, (context, session) => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, (context, session) => { var bll = context.Logics.Country; @@ -88,7 +89,7 @@ public void RemoveCountry_RemoveModificationExists() { // Arrange var countryController = this.MainWebApi.Country; - var countryId = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + var countryId = this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var bll = context.Logics.Country; @@ -124,7 +125,7 @@ public void EmulateFailureCountryModification_RaisedException() var revision = 123; this.ClearModifications(); - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var fakeModification = new DomainObjectModification() { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/OneToOneTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/OneToOneTests.cs index 8d0a1968d..58b5745f7 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/OneToOneTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/OneToOneTests.cs @@ -7,6 +7,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.MainQuery; @@ -21,7 +22,7 @@ public void GetRequestProjection_ContainsOneToOneDetail_Initialized() // Arrange var iMRequestQueryController = this.GetControllerEvaluator(); - var idents = this.DataHelper.Environment.GetContextEvaluator().Evaluate( + var idents = this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PerfomanceTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PerfomanceTests.cs index 4c383dad5..274e28146 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PerfomanceTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PerfomanceTests.cs @@ -8,6 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; namespace SampleSystem.IntegrationTests @@ -18,10 +19,10 @@ public class PerfomanceTests : TestBase [TestMethod] public void GetEmployee_ToManyFilterParameters_CheckTimeTest() { - var preEvaluate = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => context.Logics.Employee.GetUnsecureQueryable().First()); + var preEvaluate = this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => context.Logics.Employee.GetUnsecureQueryable().First()); var task = System.Threading.Tasks.Task.Run(() => - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { Expression> filter = z => false; diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PrincipalWithInitTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PrincipalWithInitTests.cs index 17f92411e..8a7f9a8e0 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PrincipalWithInitTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/PrincipalWithInitTests.cs @@ -12,6 +12,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; namespace SampleSystem.IntegrationTests @@ -45,7 +46,7 @@ public void SetUp() type: buTypeId, parent: luxoftBuId); - this.DataHelper.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => { @@ -86,7 +87,7 @@ public void CreateDuplicatePermission_ValidationError() // Act Action call = () => { - this.DataHelper.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/CustomReportsTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/CustomReportsTests.cs index b8fa6756e..3b0fa47d3 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/CustomReportsTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/CustomReportsTests.cs @@ -21,7 +21,7 @@ public class CustomReportsTests : TestBase [TestInitialize] public void InitDd() { - ActivatorUtilities.CreateInstance(this.Environment.ServiceProvider); + ActivatorUtilities.CreateInstance(this.RootServiceProvider); } [TestMethod] diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/RegularReportsTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/RegularReportsTests.cs index ad86ee50b..6380a0fcd 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/RegularReportsTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/RegularReportsTests.cs @@ -19,6 +19,7 @@ using SampleSystem.Domain; using SampleSystem.Domain.Enums; using SampleSystem.Domain.Inline; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers; using SampleSystem.WebApiCore.Controllers.Report; @@ -1282,7 +1283,7 @@ private ReportRichDTO GetReport(ReportIdentityDTO reportIdentityDTO) private ReportIdentityDTO SaveReport(Report report) { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + return this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var bll = context.Configuration.Logics.Report; bll.Save(report); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/ReportDefinitionFacadeTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/ReportDefinitionFacadeTests.cs index 9c19639a9..b2badb2fb 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/ReportDefinitionFacadeTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Reports/ReportDefinitionFacadeTests.cs @@ -5,7 +5,9 @@ using FluentAssertions; using Framework.Configuration.Generated.DTO; +using Framework.DomainDriven.ServiceModel.Service; +using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; @@ -29,7 +31,9 @@ public void GetStream_ErrorThrownInside_ProcessesError() var parameter = this.DataHelper.SaveReportParameter(report); this.DataHelper.SaveReportFilter(report, parameter); - ((TestServiceEnvironment)this.Environment).IsDebugInTest = false; + var debugModeManager = this.RootServiceProvider.GetRequiredService(); + + debugModeManager.IsDebugMode = false; var model = new ReportGenerationModelStrictDTO { @@ -49,7 +53,7 @@ public void GetStream_ErrorThrownInside_ProcessesError() var action = new Action(() => sampleSystemGenericReportController.Evaluate(c => c.GetStream(model))); // Assert - this.Environment.IsDebugMode.Should().BeFalse("not working in debugger mode"); + debugModeManager.IsDebugMode.Should().BeFalse("not working in debugger mode"); action.Should().Throw(); } diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SampleSystem.IntegrationTests.csproj b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SampleSystem.IntegrationTests.csproj index 5c24333a2..d8febd831 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SampleSystem.IntegrationTests.csproj +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SampleSystem.IntegrationTests.csproj @@ -4,12 +4,12 @@ - + - - - - + + + + diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SecurityPathTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SecurityPathTests.cs index eb45cbfaa..9960991b1 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SecurityPathTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SecurityPathTests.cs @@ -17,6 +17,7 @@ using SampleSystem.Domain; using SampleSystem.Domain.Inline; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; namespace SampleSystem.IntegrationTests @@ -31,7 +32,7 @@ public void SecurityPathWithContext_EmployeeWithoutContextRestrictions_EmployeeS var employeeIdentity = this.DataHelper.SaveEmployee(Guid.NewGuid()); // Act - var result = this.Environment.GetContextEvaluator().Evaluate( + var result = this.GetContextEvaluator().Evaluate( DBSessionMode.Read, context => { diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SpecificationTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SpecificationTests.cs index f30c9d325..3b2712b42 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SpecificationTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SpecificationTests.cs @@ -25,7 +25,7 @@ public void SpecificationWithProjection() // Act - var c = this.DataHelper.EvaluateWrite(context => context.Logics.Country.Single(new Test1NameSpecification())); + var c = this.EvaluateWrite(context => context.Logics.Country.Single(new Test1NameSpecification())); // Assert c.Name.Should().Be("test1"); @@ -40,7 +40,7 @@ public void GetQueryWithFetch() // Act var employee = - this.DataHelper.EvaluateWrite(context => context.Logics.Employee.Single(new EmployeeWithFetchSpecification())); + this.EvaluateWrite(context => context.Logics.Employee.Single(new EmployeeWithFetchSpecification())); // Assert employee.Login.Should().Be("emp1"); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SqlParserTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SqlParserTests.cs index 2ae0e3fbe..6c07deb74 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SqlParserTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SqlParserTests.cs @@ -7,6 +7,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; using SampleSystem.WebApiCore.Controllers.Main; @@ -22,8 +23,7 @@ public void SaveNullIntoNotNullProperty_RequiredConstraintDALException() var testObject = new SqlParserTestObj(); // Act - Action action = () => this.DataHelper.EvaluateWrite( - context => { context.Logics.SqlParserTestObj.Save(testObject); }); + Action action = () => this.EvaluateWrite(context => { context.Logics.SqlParserTestObj.Save(testObject); }); // Assert action.Should().Throw() @@ -39,7 +39,7 @@ public void SaveNotUniqueProperty_UniqueViolationConstraintDALException() var testObject2 = new SqlParserTestObj { UniqueColumn = "1", NotNullColumn = "2" }; // Act - Action action = () => this.DataHelper.EvaluateWrite( + Action action = () => this.EvaluateWrite( context => { context.Logics.SqlParserTestObj.Save(testObject1); @@ -59,7 +59,7 @@ public void RemoveLinkedObject_RemoveLinkedObjectsDALException() var testObject = new SqlParserTestObj { UniqueColumn = "1", NotNullColumn = "2" }; var testObjectContainer = new SqlParserTestObjContainer { IncludedObject = testObject }; - this.DataHelper.EvaluateWrite( + this.EvaluateWrite( context => { context.Logics.SqlParserTestObj.Save(testObject); @@ -67,7 +67,7 @@ public void RemoveLinkedObject_RemoveLinkedObjectsDALException() }); // Act - Action action = () => this.DataHelper.EvaluateWrite( + Action action = () => this.EvaluateWrite( context => { context.Logics.SqlParserTestObj.Remove(testObject); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SubscriptionCustomNotPersistentModelTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SubscriptionCustomNotPersistentModelTests.cs index e05dce0be..ca33f504b 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SubscriptionCustomNotPersistentModelTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/SubscriptionCustomNotPersistentModelTests.cs @@ -6,6 +6,7 @@ using Framework.DomainDriven.BLL; using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; namespace SampleSystem.IntegrationTests @@ -17,7 +18,7 @@ public class SubscriptionCustomNotPersistentModelTests : TestBase public void CustomNotPersistentNotificationModel_Always_ShouldNotThrowException() { // Arrange - var countryId = this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + var countryId = this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var country = new Country { @@ -46,7 +47,7 @@ public void CustomNotPersistentNotificationModel_Always_ShouldNotThrowException( this.ClearModifications(); // Act - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { var bll = context.Logics.Country; diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Subscriptions_Metadata/MetadataSubscriptionSystemServiceTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Subscriptions_Metadata/MetadataSubscriptionSystemServiceTests.cs index 67345fb05..21ff5ee6c 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Subscriptions_Metadata/MetadataSubscriptionSystemServiceTests.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/Subscriptions_Metadata/MetadataSubscriptionSystemServiceTests.cs @@ -103,7 +103,7 @@ public void LocalRazorTemplate_SubscriptionFromMetadataShouldBeSent() public void OnlyActiveCodeFirstSubscriptionShouldBeSent() { // Arrange - this.DataHelper.EvaluateWrite(context => + this.EvaluateWrite(context => { var bll = context.Configuration.Logics.CodeFirstSubscription; var cfs = bll.GetByCode(new EmployeeUpdateSubscription().Code); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TestTestTestTests.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TestTestTestTests.cs new file mode 100644 index 000000000..722dc8c4e --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TestTestTestTests.cs @@ -0,0 +1,28 @@ +using Framework.DomainDriven.BLL; + +using Microsoft.Extensions.DependencyInjection; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; +using SampleSystem.IntegrationTests.__Support.TestData; + +namespace SampleSystem.IntegrationTests; + +[TestClass] +public class TestTestTestTests : TestBase +{ + [TestMethod] + public void TestSecurityObjItem_LoadedByDependencySecurity() + { + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, (ctx, session) => + { + session.Flush(); + + var emp = ctx.Logics.Employee.GetFullList(); + + session.Flush(); + + return; + }); + } +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TransactionFlushBeforeCommit.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TransactionFlushBeforeCommit.cs index 05a177a0a..8345884a6 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TransactionFlushBeforeCommit.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/TransactionFlushBeforeCommit.cs @@ -4,6 +4,7 @@ using Framework.DomainDriven.BLL; using Microsoft.VisualStudio.TestTools.UnitTesting; using SampleSystem.Domain; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.TestData; namespace SampleSystem.IntegrationTests.IADFRAME_1694 @@ -16,14 +17,14 @@ public void ShouldNotConsiderChangesWhileTransactionIsNotCommited() { // Arrange var object1 = new Information { Name = "object1", Email = "email@luxoft.fake" }; - this.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Write, context => context.Logics.Information.Insert(object1, Guid.NewGuid())); var object2 = new Information { Name = "object2", Email = object1.Email }; // Act - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => + this.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { context.Logics.Information.Insert(object2, Guid.NewGuid()); @@ -33,7 +34,7 @@ public void ShouldNotConsiderChangesWhileTransactionIsNotCommited() }); // Assert - this.Environment.GetContextEvaluator().Evaluate( + this.GetContextEvaluator().Evaluate( DBSessionMode.Read, context => context.Logics.Information.GetUnsecureQueryable().Single(x => x.Email == object1.Email)) .Name diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ApplicationSettings.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ApplicationSettings.cs deleted file mode 100644 index e75f814d3..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ApplicationSettings.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Configuration; -using System.Net.Mail; - -using Framework.Core; -using Framework.DomainDriven.ServiceModel; -using Framework.Notification.DTO; - -using JetBrains.Annotations; - -namespace SampleSystem.ServiceEnvironment -{ - public class ApplicationSettings - { - public readonly string MsmqServerName; - - public readonly string IntegrationEventQueueName; - - public readonly string NotificationQueueName; - - public readonly string NotificationFromAddress; - - public readonly string NotificationFromAddressDisplayName; - - public readonly string ExceptionNotificationEmails; - - public readonly bool NotificationEnabled; - - private static readonly Lazy LazyConfiguration = LazyHelper.Create(() => - { - var msmqServerName = ConfigurationManager.AppSettings["MsmqServer"]; - var integrationEventQueueName = ConfigurationManager.AppSettings["IntegrationEventQueueName"]; - var notificationQueueName = ConfigurationManager.AppSettings["NotificationsQueueName"]; - var notificationFromAddress = ConfigurationManager.AppSettings["notificationFromAddress"]; - var notificationFromAddressDisplayName = ConfigurationManager.AppSettings["notificationFromAddressDisplayName"]; - var exceptionNotificationEmails = ConfigurationManager.AppSettings["ExceptionNotificationEmails"]; - - var notificationEnabled = bool.Parse(ConfigurationManager.AppSettings["NotificationsEnable"]); - var isTestRunMode = !string.IsNullOrEmpty(ConfigurationManager.AppSettings["TestRunMode"]); - - return new ApplicationSettings( - msmqServerName, - integrationEventQueueName, - notificationQueueName, - notificationFromAddress, - notificationFromAddressDisplayName, - exceptionNotificationEmails, - notificationEnabled, - isTestRunMode); - }); - - public ApplicationSettings( - [NotNull] string msmqServerName, - [NotNull] string integrationEventQueueName, - [NotNull] string notificationQueueName, - [NotNull] string notificationFromAddress, - [NotNull] string notificationFromAddressDisplayName, - [NotNull] string exceptionNotificationEmails, - bool notificationEnabled, - bool isTestRunMode) - { - if (msmqServerName == null) throw new ArgumentNullException(nameof(msmqServerName)); - if (integrationEventQueueName == null) throw new ArgumentNullException(nameof(integrationEventQueueName)); - if (notificationQueueName == null) throw new ArgumentNullException(nameof(notificationQueueName)); - if (notificationFromAddress == null) throw new ArgumentNullException(nameof(notificationFromAddress)); - if (notificationFromAddressDisplayName == null) throw new ArgumentNullException(nameof(notificationFromAddressDisplayName)); - if (exceptionNotificationEmails == null) throw new ArgumentNullException(nameof(exceptionNotificationEmails)); - - this.MsmqServerName = msmqServerName; - this.IntegrationEventQueueName = integrationEventQueueName; - this.NotificationQueueName = notificationQueueName; - this.NotificationFromAddress = notificationFromAddress; - this.NotificationFromAddressDisplayName = notificationFromAddressDisplayName; - this.ExceptionNotificationEmails = exceptionNotificationEmails; - this.NotificationEnabled = notificationEnabled; - } - - public static ApplicationSettings Configuration => LazyConfiguration.Value; - - public EnvironmentSettings ToEnvironmentSettings() - { - var mailAddress = new MailAddress(this.NotificationFromAddress, this.NotificationFromAddressDisplayName); - - var notificationContext = new NotificationContext(MessageSender.Trace, mailAddress, this.ExceptionNotificationEmails.Split(',')); - - return new EnvironmentSettings( - notificationContext); - } - } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluator.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluator.cs index f4cc00206..4c7ba5c10 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluator.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluator.cs @@ -1,6 +1,8 @@ using System; using System.Threading.Tasks; +using Framework.Core; +using Framework.DomainDriven.BLL; using Framework.DomainDriven.WebApiNetCore; using JetBrains.Annotations; @@ -13,7 +15,7 @@ namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment; public class ControllerEvaluator - where TController : ControllerBase, IApiControllerBase + where TController : ControllerBase { private readonly IServiceProvider rootServiceProvider; @@ -39,17 +41,31 @@ public async Task EvaluateAsync(Func> func) { using var scope = this.rootServiceProvider.CreateScope(); - var controller = scope.ServiceProvider.GetRequiredService(); + var scopeServiceProvider = scope.ServiceProvider; + var controller = scopeServiceProvider.GetRequiredService(); - controller.ServiceProvider = scope.ServiceProvider; + (controller as IApiControllerBase).Maybe(c => c.ServiceProvider = scopeServiceProvider); - if (this.customPrincipalName == null) + try { - return await func(controller); + if (this.customPrincipalName == null) + { + return await func(controller); + } + else + { + return await scopeServiceProvider.GetRequiredService().WithImpersonateAsync(this.customPrincipalName, async () => await func(controller)); + } } - else + catch { - return await scope.ServiceProvider.GetRequiredService().ImpersonateAsync(this.customPrincipalName, async () => await func(controller)); + scopeServiceProvider.TryFaultDbSession(); + + throw; + } + finally + { + scopeServiceProvider.TryCloseDbSession(); } } diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluatorContainerExtensions.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluatorContainerExtensions.cs deleted file mode 100644 index 9a848e6c1..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ControllerEvaluatorContainerExtensions.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -using Framework.Core.Services; -using Framework.DomainDriven.WebApiNetCore; - -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; - -namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment; - -public static class ControllerEvaluatorContainerExtensions -{ - public static TResult EvaluateController(this IControllerEvaluatorContainer controllerEvaluator, Func func) - where TController : ControllerBase, IApiControllerBase - { - return controllerEvaluator.RootServiceProvider.GetRequiredService>().Evaluate(func); - } - - public static void EvaluateController(this IControllerEvaluatorContainer controllerEvaluator, Action action) - where TController : ControllerBase, IApiControllerBase - { - controllerEvaluator.RootServiceProvider.GetRequiredService>().Evaluate(action); - } - - public static string GetCurrentUserName(this IControllerEvaluatorContainer controllerEvaluatorContainer) - { - return controllerEvaluatorContainer.RootServiceProvider.GetRequiredService().GetUserName(); - } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/EnvironmentSettings.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/EnvironmentSettings.cs deleted file mode 100644 index c769a6787..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/EnvironmentSettings.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -using Framework.Core; -using Framework.DomainDriven.ServiceModel; - -namespace SampleSystem.ServiceEnvironment -{ - public class EnvironmentSettings - { - public static readonly EnvironmentSettings Trace = new EnvironmentSettings(new NotificationContext(MessageSender.Trace, "SampleSystem_Sender@luxoft.com", "SampleSystem_Reciver@luxoft.com")); - - public readonly INotificationContext NotificationContext; - - public EnvironmentSettings(INotificationContext notificationContext) - { - this.NotificationContext = notificationContext ?? throw new ArgumentNullException(nameof(notificationContext)); - } - } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IControllerEvaluatorContainer.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IControllerEvaluatorContainer.cs deleted file mode 100644 index 90131c136..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IControllerEvaluatorContainer.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment; - -public interface IControllerEvaluatorContainer -{ - IServiceProvider RootServiceProvider { get; } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IRootServiceProviderContainer.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IRootServiceProviderContainer.cs new file mode 100644 index 000000000..7567844ed --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IRootServiceProviderContainer.cs @@ -0,0 +1,8 @@ +using System; + +namespace SampleSystem.IntegrationTests; + +public interface IRootServiceProviderContainer +{ + IServiceProvider RootServiceProvider { get; } +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IntegrationTestDefaultUserAuthenticationService.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IntegrationTestDefaultUserAuthenticationService.cs new file mode 100644 index 000000000..ea922182c --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IntegrationTestDefaultUserAuthenticationService.cs @@ -0,0 +1,34 @@ +using System; +using System.Threading.Tasks; + +using Framework.DomainDriven.NHibernate.Audit; + +using SampleSystem.WebApiCore.Env; + +namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment; + +public class IntegrationTestDefaultUserAuthenticationService : DomainDefaultUserAuthenticationService, IAuditRevisionUserAuthenticationService +{ + public string CustomUserName { get; private set; } + + public override string GetUserName() + { + return this.CustomUserName ?? base.GetUserName(); + } + + public async Task WithImpersonateAsync(string customUserName, Func> func) + { + var prev = this.CustomUserName; + + this.CustomUserName = customUserName; + + try + { + return await func(); + } + finally + { + this.CustomUserName = prev; + } + } +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IntegrationTestsUserAuthenticationService.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IntegrationTestsUserAuthenticationService.cs deleted file mode 100644 index f8212680c..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/IntegrationTestsUserAuthenticationService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Threading.Tasks; - -using Framework.Core.Services; - -namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment -{ - public class IntegrationTestsUserAuthenticationService : IUserAuthenticationService - { - private static readonly string DefaultUserName = $"{System.Environment.UserDomainName}\\{System.Environment.UserName}"; - - public string GetUserName() => this.CustomUserName ?? DefaultUserName; - - public string CustomUserName { get; set; } - - public async Task ImpersonateAsync(string customUserName, Func> func) - { - var prev = this.CustomUserName; - - this.CustomUserName = customUserName; - - try - { - return await func(); - } - finally - { - this.CustomUserName = prev; - } - } - } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/RootServiceProviderContainerExtensions.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/RootServiceProviderContainerExtensions.cs new file mode 100644 index 000000000..538409489 --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/RootServiceProviderContainerExtensions.cs @@ -0,0 +1,63 @@ +using System; + +using Framework.Core; +using Framework.Core.Services; +using Framework.DomainDriven; +using Framework.DomainDriven.BLL; +using Framework.DomainDriven.WebApiNetCore; + +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; + +using SampleSystem.BLL; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; + +namespace SampleSystem.IntegrationTests; + +public static class RootServiceProviderContainerExtensions +{ + public static TResult EvaluateController(this IRootServiceProviderContainer controllerEvaluator, Func func) + where TController : ControllerBase + { + return controllerEvaluator.RootServiceProvider.GetRequiredService>().Evaluate(func); + } + + public static void EvaluateController(this IRootServiceProviderContainer controllerEvaluator, Action action) + where TController : ControllerBase + { + controllerEvaluator.RootServiceProvider.GetRequiredService>().Evaluate(action); + } + + public static IContextEvaluator GetContextEvaluator(this IRootServiceProviderContainer rootServiceProviderContainer) + { + return rootServiceProviderContainer.RootServiceProvider.GetRequiredService>(); + } + + public static IDateTimeService GetDateTimeService(this IRootServiceProviderContainer rootServiceProviderContainer) + { + return rootServiceProviderContainer.RootServiceProvider.GetRequiredService(); + } + + + + + public static TResult EvaluateWrite(this IRootServiceProviderContainer rootServiceProviderContainer, Func func) + { + return rootServiceProviderContainer.GetContextEvaluator().Evaluate(DBSessionMode.Write, func); + } + + public static void EvaluateRead(this IRootServiceProviderContainer rootServiceProviderContainer, Action action) + { + rootServiceProviderContainer.GetContextEvaluator().Evaluate(DBSessionMode.Read, action); + } + + public static T EvaluateRead(this IRootServiceProviderContainer rootServiceProviderContainer, Func action) + { + return rootServiceProviderContainer.GetContextEvaluator().Evaluate(DBSessionMode.Read, action); + } + + public static void EvaluateWrite(this IRootServiceProviderContainer rootServiceProviderContainer, Action func) + { + rootServiceProviderContainer.GetContextEvaluator().Evaluate(DBSessionMode.Write, context => { func(context); return Ignore.Value; }); + } +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/SampleSystemTestServiceEnvironment.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/SampleSystemTestServiceEnvironment.cs new file mode 100644 index 000000000..aba1bb446 --- /dev/null +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/SampleSystemTestServiceEnvironment.cs @@ -0,0 +1,118 @@ +using System; +using System.Data; +using System.IO; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; + +using Framework.Authorization.ApproveWorkflow; +using Framework.Cap.Abstractions; +using Framework.Configuration.BLL.SubscriptionSystemService3.Subscriptions; +using Framework.Core; +using Framework.Core.Services; +using Framework.DomainDriven; +using Framework.DomainDriven.NHibernate.Audit; +using Framework.DomainDriven.ServiceModel.IAD; +using Framework.DomainDriven.ServiceModel.Service; +using Framework.DomainDriven.WebApiNetCore; +using Framework.Exceptions; +using Framework.NotificationCore.Services; +using Framework.NotificationCore.Settings; + +using MediatR; + +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; + +using nuSpec.Abstraction; +using nuSpec.NHibernate; + +using SampleSystem.BLL; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment.IntegrationTests; +using SampleSystem.IntegrationTests.__Support.TestData.Helpers; +using SampleSystem.ServiceEnvironment; +using SampleSystem.WebApiCore; +using SampleSystem.WebApiCore.Env; + +namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment +{ + public static class SampleSystemTestRootServiceProvider + { + public static readonly IServiceProvider Default = CreateDefault(); + + private static IServiceProvider CreateDefault() + { + var serviceProvider = BuildServiceProvider(); + + serviceProvider.RegisterAuthWorkflow(); + + return serviceProvider; + } + + + private static IServiceProvider BuildServiceProvider() + { + var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", false, true) + .AddEnvironmentVariables(nameof(SampleSystem) + "_") + .Build(); + + + return new ServiceCollection() + .RegisterLegacyBLLContext() + .RegisterControllers() + .AddControllerEnvironment() + + .AddMediatR(Assembly.GetAssembly(typeof(EmployeeBLL))) + + .AddSingleton() + .AddSingletonFrom() + .AddSingletonFrom() + + .AddScoped() + .AddScopedFrom() + .AddScopedFrom() + + .AddSingleton(new SubscriptionMetadataStore(new SampleSystemSubscriptionsMetadataFinder())) + + .AddSingleton() + .AddDatabaseSettings(InitializeAndCleanup.DatabaseUtil.ConnectionSettings.ConnectionString) + .AddScoped>() + .AddSingleton() + .AddSingleton() + .AddSingleton() + + .AddSingleton() + .AddSingletonFrom() + + .AddScoped() + .AddScoped() + .AddWorkflowCore(configuration) + .AddAuthWorkflow() + + .AddSingleton() + .AddSingleton() + + .BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true, ValidateScopes = true }); + } + + + private class TestCapTransactionManager : ICapTransactionManager + { + public void Enlist(IDbTransaction dbTransaction) + { + } + } + + private class TestIntegrationEventBus : IIntegrationEventBus + { + public Task PublishAsync(IntegrationEvent @event, CancellationToken cancellationToken) => Task.CompletedTask; + + public void Publish(IntegrationEvent @event) + { + } + } + } +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ServiceProviderExtensions.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ServiceProviderExtensions.cs index 0372f1f9f..c191979e7 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ServiceProviderExtensions.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/ServiceProviderExtensions.cs @@ -1,6 +1,6 @@ using System; -using Framework.DomainDriven.WebApiNetCore; +using Framework.DomainDriven.ServiceModel.Service; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; @@ -10,10 +10,15 @@ namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment; public static class ServiceProviderExtensions { public static ControllerEvaluator GetDefaultControllerEvaluator(this IServiceProvider serviceProvider, string principalName = null) - where TController : ControllerBase, IApiControllerBase + where TController : ControllerBase { var controllerEvaluator = serviceProvider.GetRequiredService>(); return principalName == null ? controllerEvaluator : controllerEvaluator.WithImpersonate(principalName); } } + +public class TestDebugModeManager : IDebugModeManager +{ + public bool IsDebugMode { get; set; } = true; +} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/TestServiceEnvironment.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/TestServiceEnvironment.cs deleted file mode 100644 index 3e400ee07..000000000 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/TestServiceEnvironment.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Reflection; -using System.Threading; -using System.Threading.Tasks; - -using Framework.Authorization.ApproveWorkflow; -using Framework.Cap.Abstractions; -using Framework.Configuration.BLL; -using Framework.Core; -using Framework.Core.Services; -using Framework.DomainDriven; -using Framework.DomainDriven.BLL; -using Framework.SecuritySystem.Rules.Builders; -using Framework.DomainDriven.WebApiNetCore; -using Framework.Exceptions; -using Framework.Notification.DTO; -using Framework.NotificationCore.Services; -using Framework.NotificationCore.Settings; -using Framework.Security.Cryptography; -using Framework.Validation; - -using MediatR; - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; - -using nuSpec.Abstraction; -using nuSpec.NHibernate; - -using SampleSystem.BLL; -using SampleSystem.Domain; -using SampleSystem.IntegrationTests.__Support.ServiceEnvironment.IntegrationTests; -using SampleSystem.IntegrationTests.__Support.TestData.Helpers; -using SampleSystem.ServiceEnvironment; -using SampleSystem.WebApiCore; - -using WorkflowCore.Interface; - -namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment -{ - /// - /// TestServiceEnvironment Extends EDServiceEnvironment for Test Run. Different Test Env settings are initilized. - /// - public class TestServiceEnvironment : SampleSystemServiceEnvironment - { - private static readonly Lazy DefaultLazy = new(CreateDefaultTestServiceEnvironment); - - public TestServiceEnvironment( - IServiceProvider serviceProvider, - IDBSessionFactory sessionFactory, - EnvironmentSettings settings, - IUserAuthenticationService userAuthenticationService, - bool? isDebugMode = null) - - : base(serviceProvider, sessionFactory, settings.NotificationContext, userAuthenticationService, - new OptionsWrapper(new SmtpSettings() { OutputFolder = @"C:\SampleSystem\Smtp" }), - LazyInterfaceImplementHelper.CreateNotImplemented(), - isDebugMode) - { - this.Settings = settings; - } - - /// - /// Initilize Integration Environment - /// - public static TestServiceEnvironment Default => DefaultLazy.Value; - - public bool IsDebugInTest { get; set; } = true; - - /// - /// Set IsDebugMode always true for Test run - /// - public override bool IsDebugMode => this.IsDebugInTest; - - /// - /// Environment Settings - /// - public EnvironmentSettings Settings { get; } - - private static TestServiceEnvironment CreateDefaultTestServiceEnvironment() - { - var serviceProvider = BuildServiceProvider(); - - serviceProvider.RegisterAuthWorkflow(); - - return serviceProvider.GetRequiredService(); - } - - - protected static IServiceProvider BuildServiceProvider() - { - var configuration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json", false, true) - .AddEnvironmentVariables(nameof(SampleSystem) + "_") - .Build(); - - - return new ServiceCollection() - .RegisterLegacyBLLContext() - .RegisterControllers() - .AddControllerEnvironment() - .AddMediatR(Assembly.GetAssembly(typeof(EmployeeBLL))) - .AddSingleton() - .AddSingleton(sp => sp.GetRequiredService()) - .AddSingleton() - .AddDatabaseSettings(InitializeAndCleanup.DatabaseUtil.ConnectionSettings.ConnectionString) - .AddSingleton(EnvironmentSettings.Trace) - .AddScoped>() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton(sp => sp.GetRequiredService()) - .AddSingleton().AddSingleton(sp => sp.GetRequiredService()) - - .AddSingleton(sp => sp.GetRequiredService()) - .AddSingleton() - - .AddScoped() - .AddScoped() - .AddSingleton(sp => sp.GetRequiredService().GetContextEvaluator()) - .AddSingleton() - .AddWorkflowCore(configuration) - .AddAuthWorkflow() - - .BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true, ValidateScopes = true }); - } - - protected override SampleSystemBllContextContainer CreateBLLContextContainer(IServiceProvider scopedServiceProvider, IDBSession session, string currentPrincipalName = null) - { - return new TestSampleSystemBllContextContainer( - this, - scopedServiceProvider, - this.DefaultAuthorizationValidatorCompileCache, - this.ValidatorCompileCache, - this.SecurityExpressionBuilderFactoryFunc, - this.FetchService, - this.CryptService, - CurrentTargetSystemTypeResolver, - session, - currentPrincipalName, - this.smtpSettings, - this.rewriteReceiversService); - } - - protected class TestSampleSystemBllContextContainer : SampleSystemBllContextContainer - { - - public TestSampleSystemBllContextContainer(SampleSystemServiceEnvironment serviceEnvironment, IServiceProvider scopedServiceProvider, ValidatorCompileCache defaultAuthorizationValidatorCompileCache, ValidatorCompileCache validatorCompileCache, Func> securityExpressionBuilderFactoryFunc, IFetchService fetchService, ICryptService cryptService, ITypeResolver currentTargetSystemTypeResolver, IDBSession session, string currentPrincipalName, SmtpSettings smtpSettings, IRewriteReceiversService rewriteReceiversService) - : base(serviceEnvironment, scopedServiceProvider, defaultAuthorizationValidatorCompileCache, validatorCompileCache, securityExpressionBuilderFactoryFunc, fetchService, cryptService, currentTargetSystemTypeResolver, session, currentPrincipalName, smtpSettings, rewriteReceiversService) - { - } - - protected override IMessageSender GetMessageTemplateSender() - { - return new LocalDBNotificationEventDTOMessageSender(this.Configuration); - } - protected override IEnumerable GetBeforeTransactionCompletedListeners() - { - foreach (var dalListener in base.GetBeforeTransactionCompletedListeners()) - { - yield return dalListener; - } - - yield return new PermissionWorkflowDALListener(this.MainContext); - } - } - - private class TestCapTransactionManager : ICapTransactionManager - { - public void Enlist(IDbTransaction dbTransaction) - { - } - } - - private class TestIntegrationEventBus : IIntegrationEventBus - { - public Task PublishAsync(IntegrationEvent @event, CancellationToken cancellationToken) => Task.CompletedTask; - - public void Publish(IntegrationEvent @event) - { - } - } - } -} diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/WebApiBase.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/WebApiBase.cs index 58736cfe9..0ce43ecbb 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/WebApiBase.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/ServiceEnvironment/WebApiBase.cs @@ -1,13 +1,10 @@ using System; -using Framework.DomainDriven.WebApiNetCore; - using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; namespace SampleSystem.IntegrationTests.__Support.ServiceEnvironment; -public abstract class WebApiBase : IControllerEvaluatorContainer +public abstract class WebApiBase : IRootServiceProviderContainer { private readonly IServiceProvider serviceProvider; @@ -17,10 +14,10 @@ protected WebApiBase(IServiceProvider serviceProvider) } public virtual ControllerEvaluator GetControllerEvaluator(string principalName = null) - where TController : ControllerBase, IApiControllerBase + where TController : ControllerBase { return this.serviceProvider.GetDefaultControllerEvaluator(principalName); } - IServiceProvider IControllerEvaluatorContainer.RootServiceProvider => this.serviceProvider; + IServiceProvider IRootServiceProviderContainer.RootServiceProvider => this.serviceProvider; } diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/AuthHelper.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/AuthHelper.cs index 5355e9982..8b520c297 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/AuthHelper.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/AuthHelper.cs @@ -2,34 +2,24 @@ using Automation.Utils; -using Framework.Authorization.Domain; using Framework.Authorization.Generated.DTO; -using Framework.Core; using Framework.DomainDriven.BLL; + using SampleSystem.BLL; using SampleSystem.Generated.DTO; using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; -using SampleSystem.IntegrationTests.__Support.Utils.Framework; -using SampleSystem.ServiceEnvironment; -using SampleSystem.WebApiCore; + using BusinessRole = SampleSystem.IntegrationTests.__Support.Utils.BusinessRole; -using PrincipalFullDTO = Framework.Authorization.Generated.DTO.PrincipalFullDTO; namespace SampleSystem.IntegrationTests.__Support.TestData.Helpers { - public class AuthHelper : Utils.Framework.Authorization, IControllerEvaluatorContainer + public class AuthHelper : Utils.Framework.Authorization, IRootServiceProviderContainer { - public AuthHelper() - { - } - - public AuthHelper(SampleSystemServiceEnvironment environment) + public AuthHelper(IServiceProvider rootServiceProvider) + : base(rootServiceProvider) { - this.Environment = environment; } - public SampleSystemServiceEnvironment Environment { get; set; } - public void SetUserRole(EmployeeIdentityDTO employee, params IPermissionDefinition[] permissions) { var login = this.EvaluateRead(context => context.Logics.Employee.GetById(employee.Id).Login); @@ -40,7 +30,7 @@ public void SetCurrentUserRole(BusinessRole businessRole) { this.SetCurrentUserRole(new SampleSystemPermission(businessRole)); } - + public Framework.Authorization.Generated.DTO.PrincipalIdentityDTO SavePrincipal(string name, bool active, Guid? externalId = null) { return this.EvaluateWrite(context => @@ -50,32 +40,15 @@ public Framework.Authorization.Generated.DTO.PrincipalIdentityDTO SavePrincipal( return principal.ToIdentityDTO(); }); } - + public string GetCurrentUserLogin() { return this.EvaluateRead(context => context.Authorization.CurrentPrincipalName); } - public override void EvaluateWrite(Action action) - { - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, null, action); - } - - public TResult EvaluateWrite(Func func) - { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, null, func); - } - - public TResult EvaluateRead(Func func) - { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, null, func); - } - public string GetEmployeeLogin(EmployeeIdentityDTO employee) { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, ctx => ctx.Logics.Employee.GetById(employee.Id, true).Login); + return this.GetContextEvaluator().Evaluate(DBSessionMode.Read, ctx => ctx.Logics.Employee.GetById(employee.Id, true).Login); } - - IServiceProvider IControllerEvaluatorContainer.RootServiceProvider => this.Environment.RootServiceProvider; } } diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Employee.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Employee.cs index b4df77fd0..df60c1267 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Employee.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Employee.cs @@ -7,6 +7,7 @@ using SampleSystem.Domain; using SampleSystem.Domain.Inline; using SampleSystem.Generated.DTO; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.Utils.Framework; namespace SampleSystem.IntegrationTests.__Support.TestData.Helpers @@ -100,7 +101,7 @@ public EmployeeIdentityDTO SaveEmployee( { if (!saveEmployeeWithNullHireDate) { - hireDate = hireDate ?? context.DateTimeService.CurrentMonth.StartDate; + hireDate = hireDate ?? this.GetDateTimeService().CurrentMonth.StartDate; } employee = new Employee diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Init.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Init.cs index 821740b31..5c146cce6 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Init.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.Init.cs @@ -1,48 +1,22 @@ using System; -using Framework.Core; -using Framework.DomainDriven.BLL; - using SampleSystem.BLL; using SampleSystem.Generated.DTO; using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; -using SampleSystem.ServiceEnvironment; namespace SampleSystem.IntegrationTests.__Support.TestData.Helpers { - public partial class DataHelper : IControllerEvaluatorContainer + public partial class DataHelper : IRootServiceProviderContainer { - public SampleSystemServiceEnvironment Environment { get; set; } - - - public AuthHelper AuthHelper { private get; set; } - - public TResult EvaluateWrite(Func func) + public DataHelper(IServiceProvider rootServiceProvider) { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, this.GetCurrentUserName(), func); + this.RootServiceProvider = rootServiceProvider; } - public void EvaluateRead(Action action) - { - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, this.GetCurrentUserName(), action); - } + public IServiceProvider RootServiceProvider { get; } - public TResult EvaluateRead(Func func) - { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, this.GetCurrentUserName(), func); - } - public void EvaluateWrite(Action func) - { - this.Environment.GetContextEvaluator().Evaluate( - DBSessionMode.Write, - this.GetCurrentUserName(), - context => - { - func(context); - return Ignore.Value; - }); - } + public AuthHelper AuthHelper { private get; set; } public SampleSystemServerPrimitiveDTOMappingService GetMappingService(ISampleSystemBLLContext context) { @@ -54,6 +28,5 @@ private Guid GetGuid(Guid? id) id = id ?? Guid.NewGuid(); return (Guid)id; } - IServiceProvider IControllerEvaluatorContainer.RootServiceProvider => this.Environment.RootServiceProvider; } } diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.cs index 39ed6a8d8..fb7f4ef9f 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/DataHelper.cs @@ -194,7 +194,7 @@ public BusinessUnitTypeIdentityDTO SaveBusinessUnitType( return type.ToIdentityDTO(); } - var businessUnitTypeController = this.Environment.ServiceProvider.GetDefaultControllerEvaluator(); + var businessUnitTypeController = this.RootServiceProvider.GetDefaultControllerEvaluator(); var buTypeStrict = new BusinessUnitTypeStrictDTO(businessUnitTypeController.Evaluate(c => c.GetFullBusinessUnitType(type.ToIdentityDTO()))); possibleParents = possibleParents ?? new List(); @@ -302,7 +302,7 @@ public BusinessUnitIdentityDTO SaveBusinessUnit( return this.EvaluateWrite( context => { - period = period ?? new Period(context.DateTimeService.CurrentFinancialYear.StartDate.AddYears(-1)); + period = period ?? new Period(this.GetDateTimeService().CurrentFinancialYear.StartDate.AddYears(-1)); businessUnit = context.Logics.BusinessUnit.GetById(this.GetGuid(id)); if (businessUnit == null) @@ -354,7 +354,7 @@ public ManagementUnitIdentityDTO SaveManagementUnit( context => { unit = context.Logics.ManagementUnit.GetById(this.GetGuid(id)); - period = period ?? new Period(context.DateTimeService.CurrentFinancialYear.StartDate); + period = period ?? new Period(this.GetDateTimeService().CurrentFinancialYear.StartDate); if (unit == null) { unit = new ManagementUnit diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/ServiceProviderControllerExtensions.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/ServiceProviderControllerExtensions.cs index 87330cbe9..57665e34b 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/ServiceProviderControllerExtensions.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/Helpers/ServiceProviderControllerExtensions.cs @@ -24,7 +24,7 @@ public static IServiceCollection RegisterControllers(this IServiceCollection ser }; - foreach (var controllerType in asms.SelectMany(a => a.GetTypes()).Except(exceptControllers).Where(t => !t.IsAbstract && typeof(IApiControllerBase).IsAssignableFrom(t) && typeof(ControllerBase).IsAssignableFrom(t))) + foreach (var controllerType in asms.SelectMany(a => a.GetTypes()).Except(exceptControllers).Where(t => !t.IsAbstract && typeof(ControllerBase).IsAssignableFrom(t))) { services.AddScoped(controllerType); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestBase.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestBase.cs index ab402433e..fa68d7058 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestBase.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestBase.cs @@ -16,11 +16,9 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; -using SampleSystem.BLL; using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; using SampleSystem.IntegrationTests.__Support.ServiceEnvironment.IntegrationTests; using SampleSystem.IntegrationTests.__Support.TestData.Helpers; -using SampleSystem.ServiceEnvironment; using SampleSystem.WebApiCore.Controllers; using DataHelper = SampleSystem.IntegrationTests.__Support.TestData.Helpers.DataHelper; @@ -28,27 +26,25 @@ namespace SampleSystem.IntegrationTests.__Support.TestData { [TestClass] - public class TestBase : IControllerEvaluatorContainer + public class TestBase : IRootServiceProviderContainer { - private static readonly Lazy EnvironmentLazy = new(() => TestServiceEnvironment.Default, true); - private DataHelper dataHelper; protected TestBase() { this.SetCurrentDateTime(DateTime.Now); - this.DataHelper = new DataHelper(); - this.AuthHelper = new AuthHelper(); + this.DataHelper = new DataHelper(this.RootServiceProvider); + this.AuthHelper = new AuthHelper(this.RootServiceProvider); // Workaround for System.Drawing.Common problem https://chowdera.com/2021/12/202112240234238356.html System.AppContext.SetSwitch("System.Drawing.EnableUnixSupport", true); } - protected virtual SampleSystemServiceEnvironment Environment => EnvironmentLazy.Value; + public IServiceProvider RootServiceProvider { get; } = SampleSystemTestRootServiceProvider.Default; - public MainWebApi MainWebApi => new(this.Environment.ServiceProvider); + public MainWebApi MainWebApi => new(this.RootServiceProvider); - public MainAuditWebApi MainAuditWebApi => new(this.Environment.ServiceProvider); + public MainAuditWebApi MainAuditWebApi => new(this.RootServiceProvider); protected DataHelper DataHelper { @@ -66,9 +62,7 @@ protected DataHelper DataHelper protected AuthHelper AuthHelper { get; } - protected IDateTimeService DateTimeService => this.Environment.ServiceProvider.GetRequiredService(); - - IServiceProvider IControllerEvaluatorContainer.RootServiceProvider => this.Environment.RootServiceProvider; + protected IDateTimeService DateTimeService => this.RootServiceProvider.GetRequiredService(); protected string DatabaseName { get; } = "SampleSystem"; @@ -86,8 +80,6 @@ public void TestBaseInitialize() break; } - this.DataHelper.Environment = this.Environment; - this.AuthHelper.Environment = this.Environment; //this.AuthHelper.LoginAs(); this.ClearNotifications(); @@ -195,38 +187,10 @@ protected void ClearModifications() this.EvaluateWrite(context => context.Configuration.Logics.DomainObjectModification.Pipe(bll => bll.Remove(bll.GetFullList()))); } - protected TResult EvaluateWrite(Func func) - { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Write, this.GetCurrentUserName(), func); - } - - protected void EvaluateRead(Action action) - { - this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, this.GetCurrentUserName(), action); - } - - protected T EvaluateRead(Func action) - { - return this.Environment.GetContextEvaluator().Evaluate(DBSessionMode.Read, this.GetCurrentUserName(), action); - } - - - protected void EvaluateWrite(Action func) - { - this.Environment.GetContextEvaluator().Evaluate( - DBSessionMode.Write, - this.GetCurrentUserName(), - context => - { - func(context); - return Ignore.Value; - }); - } - public ControllerEvaluator GetControllerEvaluator(string principalName = null) - where TController : ControllerBase, IApiControllerBase + where TController : ControllerBase { - return this.Environment.RootServiceProvider.GetDefaultControllerEvaluator(principalName); + return this.RootServiceProvider.GetDefaultControllerEvaluator(principalName); } protected ControllerEvaluator GetAuthControllerEvaluator(string principalName = null) diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestDataInitialize.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestDataInitialize.cs index 87063fe10..3fb12336e 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestDataInitialize.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/TestData/TestDataInitialize.cs @@ -1,9 +1,14 @@ using System.Collections.Generic; +using Framework.DomainDriven.ServiceModel.IAD; + +using Microsoft.Extensions.DependencyInjection; + using SampleSystem.Domain; using SampleSystem.Domain.Inline; using SampleSystem.Generated.DTO; using SampleSystem.IntegrationTests.__Support.Utils; +using SampleSystem.ServiceEnvironment; namespace SampleSystem.IntegrationTests.__Support.TestData { @@ -11,8 +16,7 @@ public class TestDataInitialize : TestBase { public void TestData() { - this.DataHelper.Environment = this.Environment; - this.AuthHelper.Environment = this.Environment; + this.RootServiceProvider.GetRequiredService().Initialize(); this.AuthHelper.AddCurrentUserToAdmin(); diff --git a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/Utils/Framework/Authorization.cs b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/Utils/Framework/Authorization.cs index f6bc1f7c9..5d3e21425 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/Utils/Framework/Authorization.cs +++ b/src/_SampleSystem/_Tests/SampleSystem.IntegrationTests/__Support/Utils/Framework/Authorization.cs @@ -10,12 +10,18 @@ using JetBrains.Annotations; using SampleSystem.BLL; +using SampleSystem.IntegrationTests.__Support.ServiceEnvironment; namespace SampleSystem.IntegrationTests.__Support.Utils.Framework { - public abstract class Authorization + public abstract class Authorization : IRootServiceProviderContainer { - public abstract void EvaluateWrite(Action action); + public Authorization(IServiceProvider rootServiceProvider) + { + this.RootServiceProvider = rootServiceProvider; + } + + public IServiceProvider RootServiceProvider { get; } public void SetCurrentUserRole([NotNull] params IPermissionDefinition[] permissions) { diff --git a/src/_SampleSystem/_Tests/SampleSystem.TypeScriptGenerate/SampleSystem.TypeScriptGenerate.csproj b/src/_SampleSystem/_Tests/SampleSystem.TypeScriptGenerate/SampleSystem.TypeScriptGenerate.csproj index a27bf0409..41b4ddb0a 100644 --- a/src/_SampleSystem/_Tests/SampleSystem.TypeScriptGenerate/SampleSystem.TypeScriptGenerate.csproj +++ b/src/_SampleSystem/_Tests/SampleSystem.TypeScriptGenerate/SampleSystem.TypeScriptGenerate.csproj @@ -3,9 +3,9 @@ false - - - + + + diff --git a/src/__SolutionItems/CommonAssemblyInfo.cs b/src/__SolutionItems/CommonAssemblyInfo.cs index 97b0757c8..1133b961b 100644 --- a/src/__SolutionItems/CommonAssemblyInfo.cs +++ b/src/__SolutionItems/CommonAssemblyInfo.cs @@ -4,9 +4,9 @@ [assembly: AssemblyCompany("Luxoft")] [assembly: AssemblyCopyright("Copyright © Luxoft 2009-2022")] -[assembly: AssemblyVersion("16.3.4.0")] -[assembly: AssemblyFileVersion("16.3.4.0")] -[assembly: AssemblyInformationalVersion("16.3.4")] +[assembly: AssemblyVersion("17.0.0.0")] +[assembly: AssemblyFileVersion("17.0.0.0")] +[assembly: AssemblyInformationalVersion("17.0.0")] #if DEBUG [assembly: AssemblyConfiguration("Debug")]