From 80490947b177455e8757661c19df8380270a2825 Mon Sep 17 00:00:00 2001 From: Mitrofanov Mikhail Date: Fri, 27 Jun 2025 16:20:17 +0300 Subject: [PATCH] Renaming RemoteEndpoint to Proxy --- Example.Backend/PagesList.cs | 54 ------------------- Example.Shared/IDataList.cs | 17 ------ Example.Shared/ILoadTest.cs | 4 +- Example.Shared/IPagesList.cs | 9 ---- .../{RemoteEndpoint.cstmpl => Proxy.cstmpl} | 2 +- mROA.Codegen/mROA.Codegen.csproj | 3 +- mROA.Codegen/mROASourceGenerator.cs | 4 +- .../RemoteInstanceRepository.cs | 10 ++-- 8 files changed, 12 insertions(+), 91 deletions(-) delete mode 100644 Example.Backend/PagesList.cs delete mode 100644 Example.Shared/IDataList.cs delete mode 100644 Example.Shared/IPagesList.cs rename mROA.Codegen/{RemoteEndpoint.cstmpl => Proxy.cstmpl} (93%) diff --git a/Example.Backend/PagesList.cs b/Example.Backend/PagesList.cs deleted file mode 100644 index 35db8f1..0000000 --- a/Example.Backend/PagesList.cs +++ /dev/null @@ -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 Collection { get; } - - public IPage this[int index] - { - get => GetResultAsync(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? OnAdd; - public event Action? OnRemove; - - public void Dispose() - { - // TODO release managed resources here - } - - public void OnAddExternal(IPage p0) - { - } - - public void OnRemoveExternal(IPage p0) - { - } - } -} \ No newline at end of file diff --git a/Example.Shared/IDataList.cs b/Example.Shared/IDataList.cs deleted file mode 100644 index bdaae63..0000000 --- a/Example.Shared/IDataList.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using mROA.Implementation; - -namespace Example.Shared -{ - public interface IDataList : IShared, IDisposable - { - IReadOnlyList Collection { get; } - T this[int index] { get; set; } - T Get(int index); - void Add(T item); - void Remove(int index, T item); - event Action OnAdd; - event Action OnRemove; - } -} \ No newline at end of file diff --git a/Example.Shared/ILoadTest.cs b/Example.Shared/ILoadTest.cs index a6b8d15..31a06b8 100644 --- a/Example.Shared/ILoadTest.cs +++ b/Example.Shared/ILoadTest.cs @@ -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) { } diff --git a/Example.Shared/IPagesList.cs b/Example.Shared/IPagesList.cs deleted file mode 100644 index 0b4d5d5..0000000 --- a/Example.Shared/IPagesList.cs +++ /dev/null @@ -1,9 +0,0 @@ -using mROA.Implementation.Attributes; - -namespace Example.Shared -{ - [SharedObjectInterface] - public partial interface IPagesList : IDataList - { - } -} \ No newline at end of file diff --git a/mROA.Codegen/RemoteEndpoint.cstmpl b/mROA.Codegen/Proxy.cstmpl similarity index 93% rename from mROA.Codegen/RemoteEndpoint.cstmpl rename to mROA.Codegen/Proxy.cstmpl index 0ee69af..6fb0d5c 100644 --- a/mROA.Codegen/RemoteEndpoint.cstmpl +++ b/mROA.Codegen/Proxy.cstmpl @@ -7,7 +7,7 @@ using mROA.Abstract; namespace { - partial class + partial class : RemoteObjectBase, { public (int id, IRepresentationModule representationModule, IEndPointContext context) diff --git a/mROA.Codegen/mROA.Codegen.csproj b/mROA.Codegen/mROA.Codegen.csproj index cc508dc..d836be0 100644 --- a/mROA.Codegen/mROA.Codegen.csproj +++ b/mROA.Codegen/mROA.Codegen.csproj @@ -36,10 +36,11 @@ - + + diff --git a/mROA.Codegen/mROASourceGenerator.cs b/mROA.Codegen/mROASourceGenerator.cs index 723974a..9bfe2ba 100644 --- a/mROA.Codegen/mROASourceGenerator.cs +++ b/mROA.Codegen/mROASourceGenerator.cs @@ -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)>(); diff --git a/mROA/Implementation/RemoteInstanceRepository.cs b/mROA/Implementation/RemoteInstanceRepository.cs index e8a4fca..68ea5f8 100644 --- a/mROA/Implementation/RemoteInstanceRepository.cs +++ b/mROA/Implementation/RemoteInstanceRepository.cs @@ -7,7 +7,7 @@ namespace mROA.Implementation { public class RemoteInstanceRepository : IInstanceRepository { - private List _producedRemoteEndpoints = new(); + private List _producedProxys = new(); public static Dictionary RemoteTypes = new(); private IRepresentationModuleProducer? _representationProducer; @@ -25,7 +25,7 @@ namespace mROA.Implementation public T GetObject(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(object o, IEndPointContext context)