работоспособность восстановлена, все проблемы которые подсвечиваются решены
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
using Example.Shared;
|
||||||
|
using mROA.Implementation;
|
||||||
|
using mROA.Implementation.Attributes;
|
||||||
|
|
||||||
|
namespace Example.Backend;
|
||||||
|
|
||||||
|
[SharedObjectSingleton]
|
||||||
|
public class LoadTestImp : ILoadTest
|
||||||
|
{
|
||||||
|
public int Next(int last)
|
||||||
|
{
|
||||||
|
return last + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
// See https://aka.ms/new-console-template for more information
|
// See https://aka.ms/new-console-template for more information
|
||||||
|
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Example.Shared;
|
||||||
using mROA.Codegen;
|
using mROA.Codegen;
|
||||||
using mROA.Implementation.Bootstrap;
|
using mROA.Implementation.Bootstrap;
|
||||||
using mROA.Implementation.Frontend;
|
using mROA.Implementation.Frontend;
|
||||||
@@ -20,7 +22,7 @@ mixer.Build();
|
|||||||
mixer.GetModule<NetworkFrontendBridge>().Connect();
|
mixer.GetModule<NetworkFrontendBridge>().Connect();
|
||||||
var context = mixer.GetModule<FrontendContextRepository>();
|
var context = mixer.GetModule<FrontendContextRepository>();
|
||||||
|
|
||||||
var factory = context.GetSingleObject(typeof(Example.Shared.IPrinterFactory)) as Example.Shared.IPrinterFactory;
|
var factory = context.GetSingleObject(typeof(IPrinterFactory)) as IPrinterFactory;
|
||||||
|
|
||||||
|
|
||||||
var printer = factory.Create("Test");
|
var printer = factory.Create("Test");
|
||||||
@@ -29,3 +31,16 @@ Console.WriteLine("Printer name : {0}", name);
|
|||||||
var page = await printer.Value.Print("Test Page", new CancellationToken());
|
var page = await printer.Value.Print("Test Page", new CancellationToken());
|
||||||
var data = page.Value.GetData();
|
var data = page.Value.GetData();
|
||||||
Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data));
|
Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data));
|
||||||
|
|
||||||
|
var loadSingleton = context.GetSingleObject(typeof(ILoadTest)) as ILoadTest;
|
||||||
|
|
||||||
|
const int iterations = 10000;
|
||||||
|
var timer = Stopwatch.StartNew();
|
||||||
|
for (int i = 0; i < iterations; i++)
|
||||||
|
{
|
||||||
|
var x = loadSingleton.Next(1);
|
||||||
|
Console.WriteLine(x);
|
||||||
|
}
|
||||||
|
timer.Stop();
|
||||||
|
|
||||||
|
Console.WriteLine("Time : {0}", timer.Elapsed);
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using mROA.Implementation;
|
||||||
|
using mROA.Implementation.Attributes;
|
||||||
|
|
||||||
|
namespace Example.Shared;
|
||||||
|
|
||||||
|
[SharedObjectInterface]
|
||||||
|
public interface ILoadTest
|
||||||
|
{
|
||||||
|
int Next(int last);
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
@@ -181,6 +179,7 @@ using mROA;
|
|||||||
using System;
|
using System;
|
||||||
using mROA.Implementation;
|
using mROA.Implementation;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using mROA.Abstract;
|
||||||
|
|
||||||
namespace {namespaceName};
|
namespace {namespaceName};
|
||||||
|
|
||||||
@@ -209,6 +208,7 @@ partial class {className} (int id, ISerialisationModule.IFrontendSerialisationMo
|
|||||||
var coCodegenRepoCode = @$"// <auto-generated/>
|
var coCodegenRepoCode = @$"// <auto-generated/>
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using mROA.Abstract;
|
||||||
|
|
||||||
namespace mROA.Codegen;
|
namespace mROA.Codegen;
|
||||||
|
|
||||||
@@ -250,6 +250,7 @@ public class CoCodegenMethodRepository :IMethodRepository
|
|||||||
var fronendRepoCode = @$"// <auto-generated/>
|
var fronendRepoCode = @$"// <auto-generated/>
|
||||||
using System.Collections.Frozen;
|
using System.Collections.Frozen;
|
||||||
using mROA.Implementation;
|
using mROA.Implementation;
|
||||||
|
using mROA.Abstract;
|
||||||
|
|
||||||
namespace mROA.Codegen;
|
namespace mROA.Codegen;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ public class JsonFrontendSerialisationModule
|
|||||||
parsed = JsonSerializer.Deserialize<FinalCommandExecution<T>>(receiveMessage)!;
|
parsed = JsonSerializer.Deserialize<FinalCommandExecution<T>>(receiveMessage)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed.Result = parsed.Result! is JsonElement e ? e.Deserialize<T>() : (T)parsed.Result!;
|
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,13 @@ public class TransmittedSharedObject<T> where T : notnull
|
|||||||
throw new NullReferenceException(
|
throw new NullReferenceException(
|
||||||
"DefaultContextRepository was not defined");
|
"DefaultContextRepository was not defined");
|
||||||
|
|
||||||
private int ContextId { get; init; } = -1;
|
// ReSharper disable once MemberCanBePrivate.Global
|
||||||
|
public int ContextId { get; init; } = -1;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public T? Value => GetDefaultContextRepository().GetObject<T>(ContextId);
|
public T? Value => GetDefaultContextRepository().GetObject<T>(ContextId);
|
||||||
|
|
||||||
private TransmittedSharedObject()
|
public TransmittedSharedObject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
public TransmittedSharedObject(T value)
|
public TransmittedSharedObject(T value)
|
||||||
|
|||||||
Reference in New Issue
Block a user