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 @@
-