Local endpoint added successful and negative ownerId implemented
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Example.Backend
|
||||
{
|
||||
public class PagesList : RemoteObjectBase, IPagesList
|
||||
{
|
||||
public PagesList(int id, IRepresentationModule representationModule) : base(id, representationModule)
|
||||
public PagesList(int id, IRepresentationModule representationModule,IEndPointContext context) : base(id, representationModule, context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,7 @@ class Program
|
||||
|
||||
builder.Build();
|
||||
new RemoteTypeBinder();
|
||||
|
||||
TransmissionConfig.RealContextRepository = builder.GetModule<MultiClientContextRepository>()!;
|
||||
TransmissionConfig.RemoteEndpointContextRepository = builder.GetModule<RemoteContextRepository>()!;
|
||||
TransmissionConfig.OwnershipRepository = new MultiClientOwnershipRepository();
|
||||
|
||||
|
||||
_ = builder.GetModule<UdpGateway>()!.Start();
|
||||
var gateway = builder.GetModule<IGatewayModule>();
|
||||
|
||||
@@ -37,21 +37,17 @@ class Program
|
||||
builder.Modules.Add(new CancellationRepository());
|
||||
|
||||
builder.Build();
|
||||
|
||||
|
||||
TransmissionConfig.RealContextRepository = builder.GetModule<ContextRepository>();
|
||||
TransmissionConfig.RemoteEndpointContextRepository = builder.GetModule<RemoteContextRepository>();
|
||||
|
||||
|
||||
var frontendBridge = builder.GetModule<IFrontendBridge>()!;
|
||||
frontendBridge.Connect();
|
||||
_ = builder.GetModule<RequestExtractor>()!.StartExtraction();
|
||||
_ = builder.GetModule<UdpUntrustedInteraction>().Start(serverEndPoint);
|
||||
Console.WriteLine(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
Console.WriteLine(builder.GetModule<IEndPointContext>().HostId);
|
||||
var context = builder.GetModule<RemoteContextRepository>();
|
||||
|
||||
var factory =
|
||||
context.GetSingleObject(typeof(IPrinterFactory),
|
||||
-TransmissionConfig.OwnershipRepository.GetHostOwnershipId()) as IPrinterFactory;
|
||||
builder.GetModule<IEndPointContext>()) as IPrinterFactory;
|
||||
|
||||
using (var disposingPrinter = factory.Create("Test"))
|
||||
{
|
||||
@@ -89,7 +85,7 @@ class Program
|
||||
var names = factory.CollectAllNames();
|
||||
Thread.Sleep(100);
|
||||
|
||||
Console.WriteLine(string.Join(", ", names));
|
||||
Console.WriteLine("Names: " + string.Join(", ", names));
|
||||
|
||||
var page = disposingPrinter.Print("Test Page", false, default, CancellationToken.None).GetAwaiter()
|
||||
.GetResult();
|
||||
@@ -114,7 +110,7 @@ class Program
|
||||
DemoCheck.Dispose = true;
|
||||
|
||||
|
||||
var loadSingleton = context.GetSingleObject(typeof(ILoadTest), 0) as ILoadTest;
|
||||
var loadSingleton = context.GetSingleObject(typeof(ILoadTest), builder.GetModule<IEndPointContext>()) as ILoadTest;
|
||||
|
||||
|
||||
var cts = new CancellationTokenSource();
|
||||
|
||||
@@ -216,10 +216,8 @@ namespace mROA.Cbor
|
||||
var generic = obj.GetType().GetInterfaces().FirstOrDefault(i => typeof(IShared).IsAssignableFrom(i));
|
||||
var sharedShell = typeof(SharedObjectShellShell<>).MakeGenericType(generic);
|
||||
var so =
|
||||
Activator.CreateInstance(sharedShell, obj) as
|
||||
Activator.CreateInstance(sharedShell, obj, context) as
|
||||
ISharedObjectShell;
|
||||
if (context != null)
|
||||
so.EndPointContext = context;
|
||||
|
||||
writer.WriteStartArray(1);
|
||||
writer.WriteUInt64(so.Identifier.Flat);
|
||||
|
||||
@@ -10,8 +10,8 @@ namespace <!L namespaceName>
|
||||
partial class <!L className>
|
||||
: RemoteObjectBase, <!L originalName>
|
||||
{
|
||||
public <!L className>(int id, IRepresentationModule representationModule)
|
||||
: base(id, representationModule)
|
||||
public <!L className>(int id, IRepresentationModule representationModule, IEndPointContext context)
|
||||
: base(id, representationModule, context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace mROA.Codegen
|
||||
Parameters = new object[] { <!L transferParameters> }
|
||||
};
|
||||
|
||||
module.PostCallMessageAsync(request.Id, EMessageType.EventRequest, request);
|
||||
module.PostCallMessageAsync(request.Id, EMessageType.EventRequest, request, context);
|
||||
};
|
||||
<!T>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using mROA.Implementation;
|
||||
|
||||
namespace mROA.Test;
|
||||
|
||||
[TestFixture]
|
||||
public class Identifier
|
||||
{
|
||||
[Test]
|
||||
public void TestParse()
|
||||
{
|
||||
var id = new ComplexObjectIdentifier(-1, -1);
|
||||
var flat = id.Flat;
|
||||
var next = new ComplexObjectIdentifier { Flat = flat };
|
||||
if (id.Equals(next))
|
||||
{
|
||||
Assert.Pass();
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mROA.Cbor", "mROA.Cbor\mROA
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TotalDemo", "TotalDemo", "{FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Codegen", "Codegen", "{3DB22457-E65B-426F-B3DD-08C615132B3E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -72,6 +70,5 @@ Global
|
||||
{A9BB364E-0BA6-40B9-A293-757BC48EFC06} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
{9BD25A13-3165-47C0-9EAA-5C59EC490E32} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
{3DB22457-E65B-426F-B3DD-08C615132B3E} = {EAE92F5A-664C-41AB-8811-5885524B5347}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace mROA.Abstract
|
||||
{
|
||||
int HostId { get; set; }
|
||||
int ResisterObject<T>(object o, IEndPointContext context);
|
||||
void ClearObject(ComplexObjectIdentifier id);
|
||||
void ClearObject(ComplexObjectIdentifier id, IEndPointContext context);
|
||||
T GetObject<T>(ComplexObjectIdentifier id, IEndPointContext context);
|
||||
object GetSingleObject(Type type, int ownerId);
|
||||
object GetSingleObject(Type type, IEndPointContext context);
|
||||
int GetObjectIndex<T>(object o, IEndPointContext context);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@ namespace mROA.Abstract
|
||||
{
|
||||
public interface IRemoteObjectFactory : IInjectableModule
|
||||
{
|
||||
T Produce<T>(ComplexObjectIdentifier id);
|
||||
T Produce<T>(ComplexObjectIdentifier id, IEndPointContext context);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace mROA.Implementation.Backend
|
||||
|
||||
public int GetNextIdentity()
|
||||
{
|
||||
return ++_currentId;
|
||||
return -++_currentId;
|
||||
}
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace mROA.Implementation.Backend
|
||||
{
|
||||
var repo = new ContextRepository();
|
||||
repo.FillSingletons(assemblies);
|
||||
TransmissionConfig.RealContextRepository = repo;
|
||||
builder.Modules.Add(repo);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace mROA.Implementation.Backend
|
||||
#if TRACE
|
||||
Console.WriteLine("Disposing object");
|
||||
#endif
|
||||
contextRepository.ClearObject(command.ObjectId);
|
||||
contextRepository.ClearObject(command.ObjectId, endPointContext);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -100,7 +100,7 @@ namespace mROA.Implementation.Backend
|
||||
{
|
||||
var context = command.ObjectId.ContextId != -1
|
||||
? contextRepository.GetObject<object>(command.ObjectId, endPointContext)
|
||||
: contextRepository.GetSingleObject(invoker.SuitableType, command.ObjectId.OwnerId);
|
||||
: contextRepository.GetSingleObject(invoker.SuitableType, endPointContext);
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -205,14 +205,10 @@ namespace mROA.Implementation.Backend
|
||||
};
|
||||
_cancellationRepo?.FreeCancelation(command.Id);
|
||||
|
||||
var multiClientOwnershipRepository =
|
||||
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||
|
||||
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
||||
|
||||
if (invoker.IsTrusted)
|
||||
representationModule.PostCallMessage(command.Id, EMessageType.FinishedCommandExecution,
|
||||
payload, context);
|
||||
multiClientOwnershipRepository?.FreeOwnership();
|
||||
});
|
||||
|
||||
return new AsyncCommandExecution
|
||||
@@ -254,13 +250,9 @@ namespace mROA.Implementation.Backend
|
||||
Result = finalResult
|
||||
};
|
||||
_cancellationRepo!.FreeCancelation(command.Id);
|
||||
|
||||
var multiClientOwnershipRepository =
|
||||
TransmissionConfig.OwnershipRepository as MultiClientOwnershipRepository;
|
||||
multiClientOwnershipRepository?.RegisterOwnership(representationModule.Id);
|
||||
|
||||
representationModule.PostCallMessage(command.Id, EMessageType.FinishedCommandExecution,
|
||||
payload, context);
|
||||
multiClientOwnershipRepository?.FreeOwnership();
|
||||
});
|
||||
|
||||
return new AsyncCommandExecution
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace mROA.Implementation.Backend
|
||||
|
||||
public IChannelInteractionModule GetInteraction(int id)
|
||||
{
|
||||
return _connections!.GetValueOrDefault(id, null) ?? throw new Exception("No connection found");
|
||||
return _connections!.GetValueOrDefault(id, null) ?? _connections!.GetValueOrDefault(-id, null) ?? throw new Exception("No connection found");
|
||||
}
|
||||
|
||||
public event ConnectionHandler? OnConnected;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace mROA.Implementation.Backend
|
||||
return last;
|
||||
}
|
||||
|
||||
public void ClearObject(ComplexObjectIdentifier id)
|
||||
public void ClearObject(ComplexObjectIdentifier id, IEndPointContext context)
|
||||
{
|
||||
_storage.Free(id.ContextId);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace mROA.Implementation.Backend
|
||||
return (T)value;
|
||||
}
|
||||
|
||||
public object GetSingleObject(Type type, int ownerId)
|
||||
public object GetSingleObject(Type type, IEndPointContext context)
|
||||
{
|
||||
return _singletons.GetValueOrDefault(type.GetHashCode()) ??
|
||||
throw new ArgumentException("Unregistered singleton type");
|
||||
|
||||
@@ -57,16 +57,17 @@ namespace mROA.Implementation.Backend
|
||||
var extractor = new RequestExtractor();
|
||||
var context = new EndPointContext
|
||||
{
|
||||
HostId = 0, OwnerId = interaction.Id
|
||||
HostId = 0, OwnerId = -interaction.Id
|
||||
};
|
||||
extractor.Inject(interaction);
|
||||
|
||||
if (_contextRepository is IContextRepositoryHub contextHub)
|
||||
context.RealRepository = contextHub.GetRepository(interaction.Id);
|
||||
else
|
||||
context.RealRepository = _contextRepository!;
|
||||
|
||||
context.RemoteRepository = _remoteContextRepository!;
|
||||
|
||||
extractor.Inject(context);
|
||||
extractor.Inject(_methodRepository);
|
||||
extractor.Inject(_serializationToolkit);
|
||||
extractor.Inject(_executeModule);
|
||||
|
||||
@@ -22,31 +22,31 @@ namespace mROA.Implementation.Backend
|
||||
|
||||
public int ResisterObject<T>(object o, IEndPointContext context)
|
||||
{
|
||||
var repository = GetRepositoryByClientId(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
var repository = GetRepositoryByClientId(context.OwnerId);
|
||||
return repository.ResisterObject<T>(o, context);
|
||||
}
|
||||
|
||||
public void ClearObject(ComplexObjectIdentifier id)
|
||||
public void ClearObject(ComplexObjectIdentifier id, IEndPointContext context)
|
||||
{
|
||||
var repository = GetRepositoryByClientId(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
repository.ClearObject(id);
|
||||
var repository = GetRepositoryByClientId(context.OwnerId);
|
||||
repository.ClearObject(id, context);
|
||||
}
|
||||
|
||||
public T GetObject<T>(ComplexObjectIdentifier id, IEndPointContext context)
|
||||
{
|
||||
var repository = GetRepositoryByClientId(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
var repository = GetRepositoryByClientId(context.OwnerId);
|
||||
return repository.GetObject<T>(id, context);
|
||||
}
|
||||
|
||||
public object GetSingleObject(Type type, int ownerId)
|
||||
public object GetSingleObject(Type type, IEndPointContext context)
|
||||
{
|
||||
var repository = GetRepositoryByClientId(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
return repository.GetSingleObject(type, ownerId);
|
||||
var repository = GetRepositoryByClientId(context.OwnerId);
|
||||
return repository.GetSingleObject(type, context);
|
||||
}
|
||||
|
||||
public int GetObjectIndex<T>(object o, IEndPointContext context)
|
||||
{
|
||||
var repository = GetRepositoryByClientId(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
var repository = GetRepositoryByClientId(context.OwnerId);
|
||||
return repository.GetObjectIndex<T>(o, context);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,11 +94,11 @@ namespace mROA.Implementation.Backend
|
||||
{
|
||||
case EMessageType.ClientConnect:
|
||||
context.HostId = 0;
|
||||
context.OwnerId = interaction.ConnectionId;
|
||||
context.OwnerId = -interaction.ConnectionId;
|
||||
Task.Run(async () => await streamExtractor.LoopedReceive(cts.Token));
|
||||
_ = streamExtractor.SendFromChannel(interaction.TrustedPostChanel, cts.Token);
|
||||
interaction.PostMessageAsync(new NetworkMessageHeader(_serialization!,
|
||||
new IdAssignment { Id = -interaction.ConnectionId }, null));
|
||||
new IdAssignment { Id = interaction.ConnectionId }, null));
|
||||
_extractorsCTS[interaction.ConnectionId] = cts;
|
||||
_hub!.RegisterInteraction(interaction);
|
||||
Console.WriteLine("Client registered");
|
||||
@@ -108,7 +108,7 @@ namespace mROA.Implementation.Backend
|
||||
var recoveryRequest = _serialization!.Deserialize<ClientRecovery>(connectionRequest.Data, null);
|
||||
var recoveryInteraction = _hub.GetInteraction(recoveryRequest.Id);
|
||||
|
||||
_extractorsCTS[recoveryRequest.Id].Cancel();
|
||||
_extractorsCTS[-recoveryRequest.Id].Cancel();
|
||||
|
||||
recoveryInteraction.IsConnected = () => streamExtractor.IsConnected;
|
||||
streamExtractor.MessageReceived = message =>
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace mROA.Implementation
|
||||
return placedIndex;
|
||||
}
|
||||
|
||||
public void ClearObject(ComplexObjectIdentifier id)
|
||||
public void ClearObject(ComplexObjectIdentifier id, IEndPointContext context)
|
||||
{
|
||||
_storages.Find(i => i.Key == id.OwnerId).Value.Free(id.ContextId);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace mROA.Implementation
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public object GetSingleObject(Type type, int ownerId)
|
||||
public object GetSingleObject(Type type, IEndPointContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace mROA.Implementation
|
||||
|
||||
public ulong Flat
|
||||
{
|
||||
get => (ulong)OwnerId << 32 | (uint)ContextId;
|
||||
get => (ulong)((long)OwnerId << 32 | (uint)ContextId);
|
||||
set
|
||||
{
|
||||
OwnerId = (int)(value >> 32);
|
||||
|
||||
@@ -73,7 +73,6 @@ namespace mROA.Implementation.Frontend
|
||||
|
||||
var assignment = _serialization.Deserialize<IdAssignment>(idMessage.Data, _context);
|
||||
_interactionModule.ConnectionId = -assignment.Id;
|
||||
TransmissionConfig.OwnershipRepository = new StaticOwnershipRepository(assignment.Id);
|
||||
_context.HostId = assignment.Id;
|
||||
_context.OwnerId = assignment.Id;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace mROA.Implementation.Frontend
|
||||
var initMessage = new NetworkMessageHeader
|
||||
{
|
||||
MessageType = EMessageType.UntrustedConnect, Id = Guid.NewGuid(),
|
||||
Data = BitConverter.GetBytes(Math.Abs(_channelInteractionModule.ConnectionId))
|
||||
Data = BitConverter.GetBytes(_channelInteractionModule.ConnectionId)
|
||||
};
|
||||
|
||||
var initParsed = _serializationToolkit.Serialize(initMessage, _context);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace mROA.Implementation
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void ClearObject(ComplexObjectIdentifier id)
|
||||
public void ClearObject(ComplexObjectIdentifier id, IEndPointContext context)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace mROA.Implementation
|
||||
|
||||
if (!RemoteTypes.TryGetValue(typeof(T), out var remoteType)) throw new NotSupportedException();
|
||||
var representationModule =
|
||||
_representationProducer.Produce(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
_representationProducer.Produce(context.OwnerId);
|
||||
var remote = (T)Activator.CreateInstance(remoteType, id.ContextId,
|
||||
representationModule, context)!;
|
||||
|
||||
@@ -42,16 +42,16 @@ namespace mROA.Implementation
|
||||
return remote;
|
||||
}
|
||||
|
||||
public object GetSingleObject(Type type, int ownerId)
|
||||
public object GetSingleObject(Type type, IEndPointContext context)
|
||||
{
|
||||
if (_representationProducer == null)
|
||||
throw new NullReferenceException("representation producer is not initialized");
|
||||
|
||||
var representationModule =
|
||||
_representationProducer.Produce(ownerId);
|
||||
_representationProducer.Produce(context.OwnerId);
|
||||
|
||||
_producedRemoteEndpoints.Add((Activator.CreateInstance(RemoteTypes[type], -1,
|
||||
representationModule) as RemoteObjectBase)!);
|
||||
representationModule, context) as RemoteObjectBase)!);
|
||||
|
||||
return _producedRemoteEndpoints.Last();
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace mROA.Implementation
|
||||
public static Dictionary<Type, Type> RemoteTypes = new();
|
||||
private IRepresentationModuleProducer? _representationProducer;
|
||||
|
||||
public T Produce<T>(ComplexObjectIdentifier id)
|
||||
public T Produce<T>(ComplexObjectIdentifier id, IEndPointContext context)
|
||||
{
|
||||
if (_representationProducer == null)
|
||||
throw new NullReferenceException("representation producer is not initialized");
|
||||
|
||||
if (!RemoteTypes.TryGetValue(typeof(T), out var remoteType)) throw new NotSupportedException();
|
||||
var representationModule =
|
||||
_representationProducer.Produce(TransmissionConfig.OwnershipRepository.GetOwnershipId());
|
||||
_representationProducer.Produce(context.OwnerId);
|
||||
var remote = (T)Activator.CreateInstance(remoteType, id.ContextId,
|
||||
representationModule)!;
|
||||
return remote;
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace mROA.Implementation
|
||||
}
|
||||
|
||||
public async IAsyncEnumerable<(object parced, EMessageType originalType)> GetStream(
|
||||
Predicate<NetworkMessageHeader> rule, IEndPointContext? context, [EnumeratorCancellation] CancellationToken token = default,
|
||||
Predicate<NetworkMessageHeader> rule, IEndPointContext? context,
|
||||
[EnumeratorCancellation] CancellationToken token = default,
|
||||
params Func<NetworkMessageHeader, Type?>[] converter)
|
||||
{
|
||||
var writer = _interaction?.ReceiveChanel.Writer;
|
||||
@@ -72,15 +73,14 @@ namespace mROA.Implementation
|
||||
yield return (deserialized, message.MessageType)!;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task PostCallMessageAsync<T>(Guid id, EMessageType eMessageType, T payload,
|
||||
IEndPointContext? context) where T : notnull
|
||||
{
|
||||
await PostCallMessageAsync(id, eMessageType, payload, context);
|
||||
}
|
||||
|
||||
public async Task PostCallMessageAsync(Guid id, EMessageType eMessageType, object payload,
|
||||
IEndPointContext? context)
|
||||
// public async Task PostCallMessageAsync<T>(Guid id, EMessageType eMessageType, T payload,
|
||||
// IEndPointContext? context) where T : notnull
|
||||
// {
|
||||
// await this.PostCallMessageAsync(id, eMessageType, payload, context);
|
||||
// }
|
||||
|
||||
public async Task PostCallMessageAsync<T>(Guid id, EMessageType eMessageType, T payload, IEndPointContext? context) where T : notnull
|
||||
{
|
||||
if (_interaction == null)
|
||||
throw new NullReferenceException("Interaction toolkit is not initialized");
|
||||
@@ -92,7 +92,8 @@ namespace mROA.Implementation
|
||||
{ Id = id, MessageType = eMessageType, Data = serialized });
|
||||
}
|
||||
|
||||
public void PostCallMessage<T>(Guid id, EMessageType eMessageType, T payload, IEndPointContext? context) where T : notnull
|
||||
public void PostCallMessage<T>(Guid id, EMessageType eMessageType, T payload, IEndPointContext? context)
|
||||
where T : notnull
|
||||
{
|
||||
PostCallMessageAsync(id, eMessageType, payload, context).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using mROA.Abstract;
|
||||
using mROA.Implementation.Attributes;
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
#pragma warning disable CS8618, CS9264
|
||||
// #pragma warning disable CS8618, CS9264
|
||||
|
||||
namespace mROA.Implementation
|
||||
{
|
||||
@@ -30,8 +30,9 @@ namespace mROA.Implementation
|
||||
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public SharedObjectShellShell(T value)
|
||||
public SharedObjectShellShell(T value, IEndPointContext endPointContext)
|
||||
{
|
||||
EndPointContext = endPointContext;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
@@ -57,15 +58,7 @@ namespace mROA.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
[SerializationIgnore]
|
||||
[JsonIgnore]
|
||||
public IEndPointContext EndPointContext { get; set; } = new EndPointContext
|
||||
{
|
||||
RealRepository = TransmissionConfig.RealContextRepository,
|
||||
RemoteRepository = TransmissionConfig.RemoteEndpointContextRepository,
|
||||
HostId = TransmissionConfig.OwnershipRepository.GetHostOwnershipId(),
|
||||
OwnerId = 0
|
||||
};
|
||||
[SerializationIgnore] [JsonIgnore] public IEndPointContext EndPointContext { get; set; }
|
||||
|
||||
public ComplexObjectIdentifier Identifier
|
||||
{
|
||||
@@ -96,7 +89,7 @@ namespace mROA.Implementation
|
||||
|
||||
public static implicit operator T(SharedObjectShellShell<T> value) => value.Value;
|
||||
|
||||
public static implicit operator SharedObjectShellShell<T>(T value) =>
|
||||
new(value);
|
||||
// public static implicit operator SharedObjectShellShell<T>(T value) =>
|
||||
// new(value);
|
||||
}
|
||||
}
|
||||
@@ -9,27 +9,27 @@ namespace mROA.Implementation
|
||||
#if TRACE
|
||||
public static int TotalTransmittedBytes { get; set; }
|
||||
#endif
|
||||
private static IContextRepository? _realContextRepository;
|
||||
private static IContextRepository? _remoteEndpointContextRepository;
|
||||
private static IOwnershipRepository? _ownershipRepository;
|
||||
|
||||
public static IContextRepository RealContextRepository
|
||||
{
|
||||
get => _realContextRepository ?? throw new NullReferenceException("RealContextRepository is null");
|
||||
set => _realContextRepository = value;
|
||||
}
|
||||
|
||||
public static IContextRepository RemoteEndpointContextRepository
|
||||
{
|
||||
get => _remoteEndpointContextRepository ??
|
||||
throw new NullReferenceException("RemoteEndpointContextRepository is null");
|
||||
set => _remoteEndpointContextRepository = value;
|
||||
}
|
||||
|
||||
public static IOwnershipRepository OwnershipRepository
|
||||
{
|
||||
get => _ownershipRepository ?? throw new NullReferenceException("OwnershipRepository is null");
|
||||
set => _ownershipRepository = value;
|
||||
}
|
||||
// private static IContextRepository? _realContextRepository;
|
||||
// private static IContextRepository? _remoteEndpointContextRepository;
|
||||
// private static IOwnershipRepository? _ownershipRepository;
|
||||
//
|
||||
// public static IContextRepository RealContextRepository
|
||||
// {
|
||||
// get => _realContextRepository ?? throw new NullReferenceException("RealContextRepository is null");
|
||||
// set => _realContextRepository = value;
|
||||
// }
|
||||
//
|
||||
// public static IContextRepository RemoteEndpointContextRepository
|
||||
// {
|
||||
// get => _remoteEndpointContextRepository ??
|
||||
// throw new NullReferenceException("RemoteEndpointContextRepository is null");
|
||||
// set => _remoteEndpointContextRepository = value;
|
||||
// }
|
||||
//
|
||||
// public static IOwnershipRepository OwnershipRepository
|
||||
// {
|
||||
// get => _ownershipRepository ?? throw new NullReferenceException("OwnershipRepository is null");
|
||||
// set => _ownershipRepository = value;
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user