Renaming RemoteEndpoint to Proxy

This commit is contained in:
2025-06-27 16:20:17 +03:00
parent f31ddf1604
commit 80490947b1
8 changed files with 12 additions and 91 deletions
-54
View File
@@ -1,54 +0,0 @@
using System;
using System.Collections.Generic;
using Example.Shared;
using mROA.Abstract;
using mROA.Implementation;
namespace Example.Backend
{
public class PagesList : RemoteObjectBase, IPagesList
{
public PagesList(int id, IRepresentationModule representationModule,IEndPointContext context) : base(id, representationModule, context)
{
}
public IReadOnlyList<IPage> Collection { get; }
public IPage this[int index]
{
get => GetResultAsync<IPage>(3, new object[] { index }).GetAwaiter().GetResult();
set => CallAsync(5, new object[] { index, value }).Wait();
}
public IPage Get(int index)
{
throw new NotImplementedException();
}
public void Add(IPage item)
{
throw new NotImplementedException();
}
public void Remove(int index, IPage item)
{
throw new NotImplementedException();
}
public event Action<IPage>? OnAdd;
public event Action<IPage>? OnRemove;
public void Dispose()
{
// TODO release managed resources here
}
public void OnAddExternal(IPage p0)
{
}
public void OnRemoveExternal(IPage p0)
{
}
}
}
-17
View File
@@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using mROA.Implementation;
namespace Example.Shared
{
public interface IDataList<T> : IShared, IDisposable
{
IReadOnlyList<T> Collection { get; }
T this[int index] { get; set; }
T Get(int index);
void Add(T item);
void Remove(int index, T item);
event Action<T> OnAdd;
event Action<T> OnRemove;
}
}
+2 -2
View File
@@ -17,10 +17,10 @@ namespace Example.Shared
Task AsyncTest(CancellationToken token = default);
}
partial class LoadTestRemoteEndpoint2
partial class LoadTestProxy2
: RemoteObjectBase, ILoadTest
{
public LoadTestRemoteEndpoint2(int id, IRepresentationModule representationModule, IEndPointContext context)
public LoadTestProxy2(int id, IRepresentationModule representationModule, IEndPointContext context)
: base(id, representationModule, context)
{
}
-9
View File
@@ -1,9 +0,0 @@
using mROA.Implementation.Attributes;
namespace Example.Shared
{
[SharedObjectInterface]
public partial interface IPagesList : IDataList<IPage>
{
}
}
+2 -1
View File
@@ -36,10 +36,11 @@
<ItemGroup>
<EmbeddedResource Include="PartialInterface.cstmpl" />
<EmbeddedResource Include="RemoteEndpoint.cstmpl" />
<EmbeddedResource Include="RemoteTypeBinder.cstmpl" />
<None Remove="MethodRepo.cstmpl" />
<EmbeddedResource Include="MethodRepo.cstmpl" />
<None Remove="Proxy.cstmpl" />
<EmbeddedResource Include="Proxy.cstmpl" />
</ItemGroup>
<PropertyGroup>
+2 -2
View File
@@ -46,7 +46,7 @@ namespace mROA.Codegen
_methodRepoTemplate = TemplateReader.FromEmbeddedResource("MethodRepo.cstmpl");
_methodInvokerOriginal =
((InnerTemplateSection)_methodRepoTemplate["syncInvoker"]!).InnerTemplate;
_classTemplateOriginal = TemplateReader.FromEmbeddedResource("RemoteEndpoint.cstmpl");
_classTemplateOriginal = TemplateReader.FromEmbeddedResource("Proxy.cstmpl");
_binderTemplate = TemplateReader.FromEmbeddedResource("RemoteTypeBinder.cstmpl");
_interfaceTemplateOriginal = TemplateReader.FromEmbeddedResource("PartialInterface.cstmpl");
}
@@ -116,7 +116,7 @@ namespace mROA.Codegen
var originalName = className;
className = className.TrimStart('I') + "RemoteEndpoint";
className = className.TrimStart('I') + "Proxy";
_classTemplate = (TemplateDocument)_classTemplateOriginal.Clone();
var propertiesAccessMethods = new List<(string, IMethodSymbol)>();
@@ -7,7 +7,7 @@ namespace mROA.Implementation
{
public class RemoteInstanceRepository : IInstanceRepository
{
private List<RemoteObjectBase> _producedRemoteEndpoints = new();
private List<RemoteObjectBase> _producedProxys = new();
public static Dictionary<Type, Type> RemoteTypes = new();
private IRepresentationModuleProducer? _representationProducer;
@@ -25,7 +25,7 @@ namespace mROA.Implementation
public T GetObject<T>(ComplexObjectIdentifier id, IEndPointContext context)
{
var index = _producedRemoteEndpoints.Find(i => i.Identifier.Equals(id));
var index = _producedProxys.Find(i => i.Identifier.Equals(id));
if (index is not null)
return (T)(index as object);
if (_representationProducer == null)
@@ -37,7 +37,7 @@ namespace mROA.Implementation
var remote = (T)Activator.CreateInstance(remoteType, id.ContextId,
representationModule, context)!;
_producedRemoteEndpoints.Add((remote as RemoteObjectBase)!);
_producedProxys.Add((remote as RemoteObjectBase)!);
return remote;
}
@@ -59,9 +59,9 @@ namespace mROA.Implementation
var remoteObjectBase = (RemoteObjectBase)instance;
_producedRemoteEndpoints.Add(remoteObjectBase);
_producedProxys.Add(remoteObjectBase);
return _producedRemoteEndpoints.Last();
return _producedProxys.Last();
}
public int GetObjectIndex<T>(object o, IEndPointContext context)