работает при разделенной абстракции и реализации
This commit is contained in:
@@ -7,9 +7,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\mROA.Codegen\mROA.Codegen.csproj"
|
||||
OutputItemType="Analyzer"
|
||||
ReferenceOutputAssembly="false"/>
|
||||
<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;
|
||||
@@ -7,52 +6,4 @@ namespace Example.Shared;
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user