работает при разделенной абстракции и реализации
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System.Text;
|
||||
using Example.Shared;
|
||||
|
||||
namespace Example.Backend;
|
||||
|
||||
public class Page : IPage
|
||||
{
|
||||
public string Text;
|
||||
public byte[] GetData()
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(Text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Example.Shared;
|
||||
using mROA.Implementation;
|
||||
|
||||
namespace Example.Backend;
|
||||
|
||||
|
||||
public class Printer : IPrinter
|
||||
{
|
||||
public string Name;
|
||||
public string GetName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public TransmittedSharedObject<IPage> Print(string text)
|
||||
{
|
||||
return new Page {Text = text};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Example.Backend;
|
||||
using Example.Shared;
|
||||
using mROA.Implementation;
|
||||
|
||||
namespace Example.Backend;
|
||||
|
||||
[SharedObjectSingleton]
|
||||
public class PrinterFactory : IPrinterFactory
|
||||
{
|
||||
public TransmittedSharedObject<IPrinter> Create(string printerName)
|
||||
{
|
||||
return new Printer(){Name = printerName};
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Net;
|
||||
using Example.Shared;
|
||||
using Example.Backend;
|
||||
using mROA.Codegen;
|
||||
using mROA.Implementation;
|
||||
using mROA.Implementation.Bootstrap;
|
||||
@@ -10,7 +10,7 @@ bootstrap.UseJsonSerialisation();
|
||||
bootstrap.UseNetworkGateway(new IPEndPoint(IPAddress.Loopback, 4567));
|
||||
bootstrap.UseStreamInteraction();
|
||||
bootstrap.UseBasicExecution();
|
||||
bootstrap.UseCollectableContextRepository(typeof(IPrinterFactory).Assembly);
|
||||
bootstrap.UseCollectableContextRepository(typeof(PrinterFactory).Assembly);
|
||||
bootstrap.SetupMethodsRepository(new CoCodegenMethodRepository());
|
||||
bootstrap.Build();
|
||||
|
||||
|
||||
@@ -11,7 +11,4 @@
|
||||
<ProjectReference Include="..\Example.Shared\Example.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\mROA.Codegen\mROA.Codegen.csproj"
|
||||
OutputItemType="Analyzer"
|
||||
<ProjectReference Include="..\mROA.Codegen\mROA.Codegen.csproj" OutputItemType="Analyzer"
|
||||
ReferenceOutputAssembly="false"/>
|
||||
<ProjectReference Include="..\mROA\mROA.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using mROA.Implementation;
|
||||
|
||||
namespace Example.Shared;
|
||||
|
||||
[SharedObjectInterface]
|
||||
public interface IPage
|
||||
{
|
||||
byte[] GetData();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using mROA.Implementation;
|
||||
|
||||
namespace Example.Shared;
|
||||
|
||||
[SharedObjectInterface]
|
||||
public interface IPrinter
|
||||
{
|
||||
string GetName();
|
||||
TransmittedSharedObject<IPage> Print(string text);
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text;
|
||||
using mROA.Implementation;
|
||||
|
||||
namespace Example.Shared;
|
||||
@@ -8,51 +7,3 @@ public interface IPrinterFactory
|
||||
{
|
||||
TransmittedSharedObject<IPrinter> Create(string printerName);
|
||||
}
|
||||
|
||||
|
||||
[SharedObjectSingleton]
|
||||
public class PrinterFactory : IPrinterFactory
|
||||
{
|
||||
public TransmittedSharedObject<IPrinter> Create(string printerName)
|
||||
{
|
||||
return new Printer(){Name = printerName};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[SharedObjectInterface]
|
||||
public interface IPrinter
|
||||
{
|
||||
string GetName();
|
||||
TransmittedSharedObject<IPage> Print(string text);
|
||||
|
||||
}
|
||||
|
||||
public class Printer : IPrinter
|
||||
{
|
||||
public string Name;
|
||||
public string GetName()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
public TransmittedSharedObject<IPage> Print(string text)
|
||||
{
|
||||
return new Page {Text = text};
|
||||
}
|
||||
}
|
||||
|
||||
[SharedObjectInterface]
|
||||
public interface IPage
|
||||
{
|
||||
byte[] GetData();
|
||||
}
|
||||
|
||||
public class Page : IPage
|
||||
{
|
||||
public string Text;
|
||||
public byte[] GetData()
|
||||
{
|
||||
return Encoding.UTF8.GetBytes(Text);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
"profiles": {
|
||||
"DebugRoslynSourceGenerator": {
|
||||
"commandName": "DebugRoslynComponent",
|
||||
"targetProject": "../Example.Shared/Example.Shared.csproj"
|
||||
"targetProject": "../Example.Backend/Example.Backend.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Codegen")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ed4e97e40f713de9270db709d05167c00f9c565b")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+47c67a22afbe9bd7560c8687b1d56893fcdd2fad")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Codegen")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Codegen")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA.Test")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ed4e97e40f713de9270db709d05167c00f9c565b")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+47c67a22afbe9bd7560c8687b1d56893fcdd2fad")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("mROA.Test")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("mROA.Test")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Title>mROA</Title>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -13,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("mROA")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ed4e97e40f713de9270db709d05167c00f9c565b")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+47c67a22afbe9bd7560c8687b1d56893fcdd2fad")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("mROA")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("mROA")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
Reference in New Issue
Block a user