diff --git a/Example.Backend/Page.cs b/Example.Backend/Page.cs new file mode 100644 index 0000000..a635f09 --- /dev/null +++ b/Example.Backend/Page.cs @@ -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); + } +} \ No newline at end of file diff --git a/Example.Backend/Printer.cs b/Example.Backend/Printer.cs new file mode 100644 index 0000000..640283a --- /dev/null +++ b/Example.Backend/Printer.cs @@ -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 Print(string text) + { + return new Page {Text = text}; + } +} \ No newline at end of file diff --git a/Example.Backend/PrinterFactory.cs b/Example.Backend/PrinterFactory.cs new file mode 100644 index 0000000..85390f3 --- /dev/null +++ b/Example.Backend/PrinterFactory.cs @@ -0,0 +1,14 @@ +using Example.Backend; +using Example.Shared; +using mROA.Implementation; + +namespace Example.Backend; + +[SharedObjectSingleton] +public class PrinterFactory : IPrinterFactory +{ + public TransmittedSharedObject Create(string printerName) + { + return new Printer(){Name = printerName}; + } +} \ No newline at end of file diff --git a/Example.Backend/Program.cs b/Example.Backend/Program.cs index 92685b0..3db02e2 100644 --- a/Example.Backend/Program.cs +++ b/Example.Backend/Program.cs @@ -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(); diff --git a/Example.Frontend/Example.Frontend.csproj b/Example.Frontend/Example.Frontend.csproj index a29c991..62581cc 100644 --- a/Example.Frontend/Example.Frontend.csproj +++ b/Example.Frontend/Example.Frontend.csproj @@ -11,7 +11,4 @@ - - - diff --git a/Example.Shared/Example.Shared.csproj b/Example.Shared/Example.Shared.csproj index d303a62..d4550ea 100644 --- a/Example.Shared/Example.Shared.csproj +++ b/Example.Shared/Example.Shared.csproj @@ -7,9 +7,8 @@ - + diff --git a/Example.Shared/IPage.cs b/Example.Shared/IPage.cs new file mode 100644 index 0000000..bf397a2 --- /dev/null +++ b/Example.Shared/IPage.cs @@ -0,0 +1,9 @@ +using mROA.Implementation; + +namespace Example.Shared; + +[SharedObjectInterface] +public interface IPage +{ + byte[] GetData(); +} \ No newline at end of file diff --git a/Example.Shared/IPrinter.cs b/Example.Shared/IPrinter.cs new file mode 100644 index 0000000..be1a0ed --- /dev/null +++ b/Example.Shared/IPrinter.cs @@ -0,0 +1,11 @@ +using mROA.Implementation; + +namespace Example.Shared; + +[SharedObjectInterface] +public interface IPrinter +{ + string GetName(); + TransmittedSharedObject Print(string text); + +} \ No newline at end of file diff --git a/Example.Shared/IPrinterFactory.cs b/Example.Shared/IPrinterFactory.cs index 40d75ad..3c11aad 100644 --- a/Example.Shared/IPrinterFactory.cs +++ b/Example.Shared/IPrinterFactory.cs @@ -1,4 +1,3 @@ -using System.Text; using mROA.Implementation; namespace Example.Shared; @@ -7,52 +6,4 @@ namespace Example.Shared; public interface IPrinterFactory { TransmittedSharedObject Create(string printerName); -} - - -[SharedObjectSingleton] -public class PrinterFactory : IPrinterFactory -{ - public TransmittedSharedObject Create(string printerName) - { - return new Printer(){Name = printerName}; - } -} - - -[SharedObjectInterface] -public interface IPrinter -{ - string GetName(); - TransmittedSharedObject Print(string text); - -} - -public class Printer : IPrinter -{ - public string Name; - public string GetName() - { - return Name; - } - - public TransmittedSharedObject 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); - } } \ No newline at end of file diff --git a/mROA.Codegen/Properties/launchSettings.json b/mROA.Codegen/Properties/launchSettings.json index 8403a4d..95224bd 100644 --- a/mROA.Codegen/Properties/launchSettings.json +++ b/mROA.Codegen/Properties/launchSettings.json @@ -3,7 +3,7 @@ "profiles": { "DebugRoslynSourceGenerator": { "commandName": "DebugRoslynComponent", - "targetProject": "../Example.Shared/Example.Shared.csproj" + "targetProject": "../Example.Backend/Example.Backend.csproj" } } } \ No newline at end of file diff --git a/mROA.Codegen/obj/Debug/netstandard2.0/mROA.Codegen.AssemblyInfo.cs b/mROA.Codegen/obj/Debug/netstandard2.0/mROA.Codegen.AssemblyInfo.cs index c13aac7..b18a2fc 100644 --- a/mROA.Codegen/obj/Debug/netstandard2.0/mROA.Codegen.AssemblyInfo.cs +++ b/mROA.Codegen/obj/Debug/netstandard2.0/mROA.Codegen.AssemblyInfo.cs @@ -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")] diff --git a/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs b/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs index 30194f9..c9ee413 100644 --- a/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs +++ b/mROA.Test/obj/Debug/net9.0/mROA.Test.AssemblyInfo.cs @@ -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")] diff --git a/mROA/mROA.csproj b/mROA/mROA.csproj index 17b910f..92403d3 100644 --- a/mROA/mROA.csproj +++ b/mROA/mROA.csproj @@ -4,6 +4,7 @@ net9.0 enable enable + mROA diff --git a/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs b/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs index dd40c01..8a6d99e 100644 --- a/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs +++ b/mROA/obj/Debug/net9.0/mROA.AssemblyInfo.cs @@ -1,9 +1,10 @@ //------------------------------------------------------------------------------ // -// 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. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ @@ -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")]