diff --git a/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs b/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs
index d0633e2..ae5fb80 100644
--- a/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs
+++ b/mROA.Performance/obj/Release/net9.0/mROA.Performance.AssemblyInfo.cs
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Performance")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2f1a1e250b1a9c031df21e3ec1087cb18b8fa784")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9128f3f6ee0d3c89e7e0538ac244a133c746e4df")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Performance")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Performance")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props b/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props
index 566ee42..c738a62 100644
--- a/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props
+++ b/mROA.Performance/obj/mROA.Performance.csproj.nuget.g.props
@@ -7,7 +7,7 @@
$(UserProfile)\.nuget\packages\
C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages
PackageReference
- 6.10.1
+ 6.12.2
diff --git a/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs b/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs
index 093b6a7..fe2d30c 100644
--- a/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs
+++ b/mROA.Test/obj/Release/net9.0/mROA.Test.AssemblyInfo.cs
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2f1a1e250b1a9c031df21e3ec1087cb18b8fa784")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9128f3f6ee0d3c89e7e0538ac244a133c746e4df")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props
index 3598713..8b66f76 100644
--- a/mROA.Test/obj/mROA.Test.csproj.nuget.g.props
+++ b/mROA.Test/obj/mROA.Test.csproj.nuget.g.props
@@ -7,7 +7,7 @@
$(UserProfile)\.nuget\packages\
C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages
PackageReference
- 6.10.1
+ 6.12.2
diff --git a/mROA/Implementation/PrepairedExecutionModule.cs b/mROA/Implementation/PrepairedExecutionModule.cs
index 4523d4a..4e4552e 100644
--- a/mROA/Implementation/PrepairedExecutionModule.cs
+++ b/mROA/Implementation/PrepairedExecutionModule.cs
@@ -8,7 +8,7 @@ public class PrepairedExecutionModule : IExecuteModule
private readonly ISerialisationModule _serialisationModule;
private readonly IContextRepository _contextRepo;
private readonly MethodInfo _resultExtractionMethod;
-
+
public PrepairedExecutionModule(IMethodRepository methodRepo,
ISerialisationModule serialisationModule,
IContextRepository contextRepo)
@@ -17,7 +17,6 @@ public class PrepairedExecutionModule : IExecuteModule
_serialisationModule = serialisationModule;
_contextRepo = contextRepo;
_serialisationModule.SetExecuteModule(this);
-
}
public ICommandExecution Execute(ICallRequest command)
@@ -26,54 +25,71 @@ public class PrepairedExecutionModule : IExecuteModule
if (currentCommand == null)
throw new Exception($"Command {command.CommandId} not found");
- var context = command.ObjectId != -1 ? _contextRepo.GetObject(command.ObjectId) : _contextRepo.GetSingleObject(currentCommand.DeclaringType);
+ var context = command.ObjectId != -1
+ ? _contextRepo.GetObject(command.ObjectId)
+ : _contextRepo.GetSingleObject(currentCommand.DeclaringType);
var parameter = command.Parameter;
- if (currentCommand.ReturnType.BaseType == typeof(Task) && currentCommand.ReturnType.GenericTypeArguments.Length == 1)
- {
- var tokenSource = new CancellationTokenSource();
- var token = tokenSource.Token;
-
- var result =
- currentCommand.Invoke(context, parameter is null ? [token] : [parameter, token]) as Task;
- var exec = new AsyncCommandExecution(tokenSource)
- { CommandId = command.CommandId, ClientId = command.ClientId };
-
- result.ContinueWith(task =>
- {
- var result = task.GetType().GetProperty("Result").GetValue(task);
- _serialisationModule.PostResponse(new FinalCommandExecution
- {
- ExecutionId = exec.ExecutionId, Result = result, CommandId = command.CommandId,
- ClientId = command.ClientId
- });
- }, token);
-
- return exec;
- }
-
+ if (currentCommand.ReturnType.BaseType == typeof(Task) &&
+ currentCommand.ReturnType.GenericTypeArguments.Length == 1)
+ return TypedExecuteAsync(currentCommand, context, parameter, command);
+
if (currentCommand.ReturnType == typeof(Task))
- {
- var tokenSource = new CancellationTokenSource();
- var token = tokenSource.Token;
-
- var result = currentCommand.Invoke(context, parameter is null ? [token] : [parameter, token]) as Task;
- var exec = new AsyncCommandExecution(tokenSource)
- { CommandId = command.CommandId, ClientId = command.ClientId };
-
- result.ContinueWith(_ =>
- {
- _serialisationModule.PostResponse(new FinalCommandExecution
- {
- ExecutionId = exec.ExecutionId, Result = null, CommandId = command.CommandId,
- ClientId = command.ClientId
- });
- }, token);
-
- return exec;
- }
+ return ExecuteAsync(currentCommand, context, parameter, command);
+
+ return Execute(currentCommand, context, parameter, command);
+ }
+ private ICommandExecution Execute(MethodInfo currentCommand, object context, object parameter, ICallRequest request)
+ {
var finalResult = currentCommand.Invoke(context, parameter is null ? [] : [parameter]);
- return new FinalCommandExecution { CommandId = command.CommandId, Result = finalResult };
+ return new FinalCommandExecution
+ { CommandId = request.CommandId, Result = finalResult, ClientId = request.ClientId };
+ }
+
+ private ICommandExecution ExecuteAsync(MethodInfo currentCommand, object context, object parameter,
+ ICallRequest command)
+ {
+ var tokenSource = new CancellationTokenSource();
+ var token = tokenSource.Token;
+
+ var result = currentCommand.Invoke(context, parameter is null ? [token] : [parameter, token]) as Task;
+ var exec = new AsyncCommandExecution(tokenSource)
+ { CommandId = command.CommandId, ClientId = command.ClientId };
+
+ result.ContinueWith(_ =>
+ {
+ _serialisationModule.PostResponse(new FinalCommandExecution
+ {
+ ExecutionId = exec.ExecutionId, Result = null, CommandId = command.CommandId,
+ ClientId = command.ClientId
+ });
+ }, token);
+
+ return exec;
+ }
+
+ private ICommandExecution TypedExecuteAsync(MethodInfo currentCommand, object context, object parameter,
+ ICallRequest command)
+ {
+ var tokenSource = new CancellationTokenSource();
+ var token = tokenSource.Token;
+
+ var result =
+ currentCommand.Invoke(context, parameter is null ? [token] : [parameter, token]) as Task;
+ var exec = new AsyncCommandExecution(tokenSource)
+ { CommandId = command.CommandId, ClientId = command.ClientId };
+
+ result.ContinueWith(task =>
+ {
+ var result = task.GetType().GetProperty("Result").GetValue(task);
+ _serialisationModule.PostResponse(new FinalCommandExecution
+ {
+ ExecutionId = exec.ExecutionId, Result = result, CommandId = command.CommandId,
+ ClientId = command.ClientId
+ });
+ }, token);
+
+ return exec;
}
}
\ No newline at end of file
diff --git a/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs b/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs
index 3bbc395..98b76d5 100644
--- a/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs
+++ b/mROA/obj/Release/net9.0/mROA.AssemblyInfo.cs
@@ -1,9 +1,10 @@
//------------------------------------------------------------------------------
//
-// This code was generated by a tool.
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
//
//------------------------------------------------------------------------------
@@ -13,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
-[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2f1a1e250b1a9c031df21e3ec1087cb18b8fa784")]
+[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9128f3f6ee0d3c89e7e0538ac244a133c746e4df")]
[assembly: System.Reflection.AssemblyProductAttribute("mROA")]
[assembly: System.Reflection.AssemblyTitleAttribute("mROA")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
diff --git a/mROA/obj/mROA.csproj.nuget.g.props b/mROA/obj/mROA.csproj.nuget.g.props
index 566ee42..c738a62 100644
--- a/mROA/obj/mROA.csproj.nuget.g.props
+++ b/mROA/obj/mROA.csproj.nuget.g.props
@@ -7,7 +7,7 @@
$(UserProfile)\.nuget\packages\
C:\Users\Mimm\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages
PackageReference
- 6.10.1
+ 6.12.2