2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2026-06-13 22:48:42 +00:00
This commit is contained in:
2026-06-08 18:01:02 +03:00
parent 340798a5fa
commit 253a24a466
34 changed files with 237 additions and 1135 deletions
@@ -1,10 +0,0 @@
using System;
namespace Esiur
{
public static class Generated
{
public static Type[] Resources { get; } = new Type[] { typeof(RPC.EsiurTest.Service), typeof(RPC.EsiurTest.TestObject) };
public static Type[] Records { get; } = new Type[] { typeof(RPC.EsiurTest.BusinessDocument), typeof(RPC.EsiurTest.Attachment), typeof(RPC.EsiurTest.Party), typeof(RPC.EsiurTest.Address), typeof(RPC.EsiurTest.DocumentHeader), typeof(RPC.EsiurTest.LineItem), typeof(RPC.EsiurTest.Variant), typeof(RPC.EsiurTest.Payment) };
public static Type[] Enums { get; } = new Type[] { typeof(RPC.EsiurTest.Currency), typeof(RPC.EsiurTest.DocType), typeof(RPC.EsiurTest.Kind), typeof(RPC.EsiurTest.LineType), typeof(RPC.EsiurTest.PaymentMethod) };
}
}
@@ -3,28 +3,29 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("0f8f447ee993847189b2c1ad6f83931a")]
[Remote("Esiur.Tests.RPC.EsiurServer.Address", "")]
[Export]
public class Address : IRecord
{
[Annotation("String")]
[Annotation("", "String")]
public string City { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Country { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Line1 { get; set; }
[Annotation("String")]
public string? Line2 { get; set; }
[Annotation("", "String")]
public string Line2 { get; set; }
[Annotation("String")]
public string? PostalCode { get; set; }
[Annotation("", "String")]
public string PostalCode { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Region { get; set; }
public override bool Equals(object? obj)
@@ -41,9 +42,9 @@ namespace RPC.EsiurTest
return true;
}
public SharedModel.Address ToShared()
public Client.SharedModel.Address ToShared()
{
return new SharedModel.Address()
return new Client.SharedModel.Address()
{
City = City,
Country = Country,
@@ -55,9 +56,9 @@ namespace RPC.EsiurTest
};
}
public Echo.Model.Grpc.Address ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.Address ToGrpc()
{
return new Echo.Model.Grpc.Address()
return new Esiur.Tests.RPC.Client.Grpc.Address()
{
City = City,
Country = Country,
@@ -80,5 +81,6 @@ namespace RPC.EsiurTest
Region = Region,
};
}
}
}
@@ -1,24 +1,25 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Esiur.Resource;
using Google.Protobuf;
namespace RPC.EsiurTest
using System;
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("4befaa686f038a2885268fca4cbf3c2c")]
[Remote("Esiur.Tests.RPC.EsiurServer.Attachment", "")]
[Export]
public class Attachment : IRecord
{
[Annotation("Byte[]")]
[Annotation("", "Byte[]")]
public byte[] Data { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string MimeType { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Name { get; set; }
public override bool Equals(object? obj)
{
var other = obj as Attachment;
@@ -29,9 +30,9 @@ namespace RPC.EsiurTest
return true;
}
public SharedModel.Attachment ToShared()
public Client.SharedModel.Attachment ToShared()
{
return new SharedModel.Attachment()
return new Client.SharedModel.Attachment()
{
Data = Data,
MimeType = MimeType,
@@ -39,9 +40,9 @@ namespace RPC.EsiurTest
};
}
public Echo.Model.Grpc.Attachment ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.Attachment ToGrpc()
{
return new Echo.Model.Grpc.Attachment()
return new Esiur.Tests.RPC.Client.Grpc.Attachment()
{
Data = ByteString.CopyFrom(Data),
MimeType = MimeType,
@@ -3,34 +3,32 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Google.Protobuf;
using Google.Protobuf.Collections;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("9a34d22890e787b48133a2a61ac84ad8")]
[Remote("Esiur.Tests.RPC.EsiurServer.BusinessDocument", "")]
[Export]
public class BusinessDocument : IRecord
{
[Annotation("Attachment[]")]
public RPC.EsiurTest.Attachment[] Attachments { get; set; }
[Annotation("", "Attachment[]")]
public Esiur.Tests.RPC.EsiurServer.Attachment[] Attachments { get; set; }
[Annotation("Party")]
public RPC.EsiurTest.Party Buyer { get; set; }
[Annotation("", "Party")]
public Esiur.Tests.RPC.EsiurServer.Party Buyer { get; set; }
[Annotation("DocumentHeader")]
public RPC.EsiurTest.DocumentHeader Header { get; set; }
[Annotation("", "DocumentHeader")]
public Esiur.Tests.RPC.EsiurServer.DocumentHeader Header { get; set; }
[Annotation("LineItem[]")]
public RPC.EsiurTest.LineItem[] Items { get; set; }
[Annotation("", "LineItem[]")]
public Esiur.Tests.RPC.EsiurServer.LineItem[] Items { get; set; }
[Annotation("Payment[]")]
public RPC.EsiurTest.Payment[] Payments { get; set; }
[Annotation("", "Payment[]")]
public Esiur.Tests.RPC.EsiurServer.Payment[] Payments { get; set; }
[Annotation("Int32[]")]
[Annotation("", "Int32[]")]
public int[] RiskScores { get; set; }
[Annotation("Party")]
public RPC.EsiurTest.Party Seller { get; set; }
[Annotation("", "Party")]
public Esiur.Tests.RPC.EsiurServer.Party Seller { get; set; }
public override bool Equals(object? obj)
{
@@ -68,15 +66,15 @@ namespace RPC.EsiurTest
}
public SharedModel.BusinessDocument ToShared()
public Client.SharedModel.BusinessDocument ToShared()
{
return new SharedModel.BusinessDocument()
return new Client.SharedModel.BusinessDocument()
{
Attachments = Attachments?.Select(x=>x.ToShared()).ToArray() ?? null,
Attachments = Attachments?.Select(x => x.ToShared()).ToArray() ?? null,
Buyer = Buyer.ToShared(),
Header = Header.ToShared(),
Items = Items.Select(x=>x.ToShared()).ToArray(),
Payments = Payments.Select(x=>x.ToShared()).ToArray(),
Items = Items.Select(x => x.ToShared()).ToArray(),
Payments = Payments.Select(x => x.ToShared()).ToArray(),
RiskScores = RiskScores,
Seller = Seller.ToShared(),
};
@@ -87,7 +85,7 @@ namespace RPC.EsiurTest
var rt = new Echo.ThriftModel.BusinessDocument();
if (Header != null)
rt.Header = Header.ToThrift();
rt.Header = Header.ToThrift();
if (Buyer != null)
rt.Buyer = Buyer.ToThrift();
@@ -96,7 +94,7 @@ namespace RPC.EsiurTest
rt.Seller = Seller.ToThrift();
if (Attachments != null)
rt.Attachments = Attachments.Select(x=>x.ToThrift()).ToList();
rt.Attachments = Attachments.Select(x => x.ToThrift()).ToList();
if (RiskScores != null)
rt.RiskScores = RiskScores.ToList();
@@ -110,10 +108,10 @@ namespace RPC.EsiurTest
return rt;
}
public Echo.Model.Grpc.BusinessDocument ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.BusinessDocument ToGrpc()
{
var rt = new Echo.Model.Grpc.BusinessDocument()
var rt = new Esiur.Tests.RPC.Client.Grpc.BusinessDocument()
{
Header = Header.ToGrpc(),
Buyer = Buyer.ToGrpc(),
@@ -140,6 +138,5 @@ namespace RPC.EsiurTest
return rt;
}
}
}
@@ -3,9 +3,9 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("c44e42333dfd8d3485bb2a79fd7a9f6f")]
[Remote("Esiur.Tests.RPC.EsiurServer.Currency", "")]
[Export]
public enum Currency
{
@@ -3,9 +3,9 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("6ded4eca74c8886a85a74e082770be4b")]
[Remote("Esiur.Tests.RPC.EsiurServer.DocType", "")]
[Export]
public enum DocType
{
@@ -4,49 +4,49 @@ using Esiur.Protocol;
using Esiur.Resource;
using Google.Protobuf;
using System;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("4631164f62d489e68ffab70e20b421f2")]
[Remote("Esiur.Tests.RPC.EsiurServer.DocumentHeader", "")]
[Export]
public class DocumentHeader : IRecord
{
[Annotation("DateTime")]
[Annotation("", "DateTime")]
public DateTime CreatedAt { get; set; }
[Annotation("Currency")]
public RPC.EsiurTest.Currency Currency { get; set; }
[Annotation("", "Currency")]
public Esiur.Tests.RPC.EsiurServer.Currency Currency { get; set; }
[Annotation("Byte[]")]
[Annotation("", "Byte[]")]
public byte[] DocId { get; set; }
[Annotation("Dictionary`2")]
public Map<string, RPC.EsiurTest.Variant> Meta { get; set; }
[Annotation("", "Dictionary`2")]
public Map<string, Esiur.Tests.RPC.EsiurServer.Variant> Meta { get; set; }
[Annotation("String")]
public string? Notes { get; set; }
[Annotation("", "String")]
public string Notes { get; set; }
[Annotation("DocType")]
public RPC.EsiurTest.DocType Type { get; set; }
[Annotation("", "DocType")]
public Esiur.Tests.RPC.EsiurServer.DocType Type { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public DateTime? UpdatedAt { get; set; }
[Annotation("Int32")]
[Annotation("", "Int32")]
public int Version { get; set; }
public SharedModel.DocumentHeader ToShared()
public Client.SharedModel.DocumentHeader ToShared()
{
return new SharedModel.DocumentHeader()
return new Client.SharedModel.DocumentHeader()
{
CreatedAt = CreatedAt,
DocId = DocId,
Meta = Meta.ToDictionary(x=>x.Key, v=>v.Value.ToShared()),
Meta = Meta.ToDictionary(x => x.Key, v => v.Value.ToShared()),
Notes = Notes,
Currency = Enum.Parse<SharedModel.Currency>(Currency.ToString(), true),
Currency = Enum.Parse<Client.SharedModel.Currency>(Currency.ToString(), true),
UpdatedAt = UpdatedAt,
Version = Version,
Type = Enum.Parse<SharedModel.DocType>(Type.ToString(), true)
Type = Enum.Parse<Client.SharedModel.DocType>(Type.ToString(), true)
};
}
@@ -55,11 +55,11 @@ namespace RPC.EsiurTest
var rt = new Echo.ThriftModel.DocumentHeader()
{
DocId = DocId,
CreatedAt = CreatedAt.Ticks,
Currency = Enum.Parse< Echo.ThriftModel.Currency>(Currency.ToString(), true),
Type = Enum.Parse< Echo.ThriftModel.DocType>(Type.ToString(), true),
CreatedAt = CreatedAt.Ticks,
Currency = Enum.Parse<Echo.ThriftModel.Currency>(Currency.ToString(), true),
Type = Enum.Parse<Echo.ThriftModel.DocType>(Type.ToString(), true),
Version = Version,
Meta = Meta.ToDictionary(x=>x.Key, x=>x.Value.ToThrift())
Meta = Meta.ToDictionary(x => x.Key, x => x.Value.ToThrift())
};
if (UpdatedAt != null)
@@ -71,13 +71,13 @@ namespace RPC.EsiurTest
return rt;
}
public Echo.Model.Grpc.DocumentHeader ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.DocumentHeader ToGrpc()
{
var hdr = new Echo.Model.Grpc.DocumentHeader();
var hdr = new Esiur.Tests.RPC.Client.Grpc.DocumentHeader();
hdr.DocId = ByteString.CopyFrom(DocId);
hdr.CreatedAt = CreatedAt.Ticks;
hdr.Currency = Enum.Parse<Echo.Model.Grpc.Currency>(Currency.ToString(), true);
hdr.Currency = Enum.Parse<Esiur.Tests.RPC.Client.Grpc.Currency>(Currency.ToString(), true);
hdr.Version = Version;
hdr.Notes = Notes;
@@ -3,9 +3,9 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("32ae8265068382608399b7e427be37db")]
[Remote("Esiur.Tests.RPC.EsiurServer.Kind", "")]
[Export]
public enum Kind
{
@@ -3,46 +3,46 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("142f42b0e1a78c098f35fa935cde22c1")]
[Remote("Esiur.Tests.RPC.EsiurServer.LineItem", "")]
[Export]
public class LineItem : IRecord
{
[Annotation("String")]
[Annotation("", "String")]
public string Description { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public double? Discount { get; set; }
[Annotation("Map`2")]
public Map<string, RPC.EsiurTest.Variant> Ext { get; set; }
[Annotation("", "Map`2")]
public Map<string, Esiur.Tests.RPC.EsiurServer.Variant> Ext { get; set; }
[Annotation("Int32")]
[Annotation("", "Int32")]
public int LineNo { get; set; }
[Annotation("Double")]
[Annotation("", "Double")]
public double Qty { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string QtyUnit { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string SKU { get; set; }
[Annotation("LineType")]
public RPC.EsiurTest.LineType Type { get; set; }
[Annotation("", "LineType")]
public Esiur.Tests.RPC.EsiurServer.LineType Type { get; set; }
[Annotation("Double")]
[Annotation("", "Double")]
public double UnitPrice { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public double? VatRate { get; set; }
public SharedModel.LineItem ToShared()
public Client.SharedModel.LineItem ToShared()
{
return new SharedModel.LineItem()
return new Client.SharedModel.LineItem()
{
Description = Description,
Discount = Discount,
@@ -51,7 +51,7 @@ namespace RPC.EsiurTest
Qty = Qty,
QtyUnit = QtyUnit,
SKU = SKU,
Type = Enum.Parse<SharedModel.LineType>(Type.ToString(), true),
Type = Enum.Parse<Client.SharedModel.LineType>(Type.ToString(), true),
UnitPrice = UnitPrice,
VatRate = VatRate
};
@@ -80,9 +80,9 @@ namespace RPC.EsiurTest
return rt;
}
public Echo.Model.Grpc.LineItem ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.LineItem ToGrpc()
{
var rt = new Echo.Model.Grpc.LineItem()
var rt = new Esiur.Tests.RPC.Client.Grpc.LineItem()
{
Description = Description,
Discount = Discount ?? 0,
@@ -91,7 +91,7 @@ namespace RPC.EsiurTest
UnitPrice = UnitPrice,
QtyUnit = QtyUnit,
Sku = SKU,
Type = Enum.Parse<Echo.Model.Grpc.LineType>(Type.ToString(), true),
Type = Enum.Parse<Esiur.Tests.RPC.Client.Grpc.LineType>(Type.ToString(), true),
VatRate = VatRate ?? 0,
};
@@ -3,9 +3,9 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("7e474e8826e288f28bddddf69782c580")]
[Remote("Esiur.Tests.RPC.EsiurServer.LineType", "")]
[Export]
public enum LineType
{
@@ -3,36 +3,36 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("44fff9c7bd9b86f580bf479a64cb84af")]
[Remote("Esiur.Tests.RPC.EsiurServer.Party", "")]
[Export]
public class Party : IRecord
{
[Annotation("Address")]
public RPC.EsiurTest.Address Address { get; set; }
[Annotation("", "Address")]
public Esiur.Tests.RPC.EsiurServer.Address Address { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Email { get; set; }
[Annotation("UInt64")]
[Annotation("", "UInt64")]
public ulong Id { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Name { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Phone { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string PreferredLanguage { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string TaxId { get; set; }
public SharedModel.Party ToShared()
public Client.SharedModel.Party ToShared()
{
return new SharedModel.Party()
return new Client.SharedModel.Party()
{
Address = Address.ToShared(),
Email = Email,
@@ -58,9 +58,9 @@ namespace RPC.EsiurTest
};
}
public Echo.Model.Grpc.Party ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.Party ToGrpc()
{
return new Echo.Model.Grpc.Party()
return new Esiur.Tests.RPC.Client.Grpc.Party()
{
Address = Address.ToGrpc(),
Email = Email,
@@ -3,38 +3,38 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("f172196340298b8586fed434c72bc158")]
[Remote("Esiur.Tests.RPC.EsiurServer.Payment", "")]
[Export]
public class Payment : IRecord
{
[Annotation("Double")]
[Annotation("", "Double")]
public double Amount { get; set; }
[Annotation("Currency")]
public RPC.EsiurTest.Currency Currency { get; set; }
[Annotation("", "Currency")]
public Esiur.Tests.RPC.EsiurServer.Currency Currency { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public double? Fee { get; set; }
[Annotation("PaymentMethod")]
public RPC.EsiurTest.PaymentMethod Method { get; set; }
[Annotation("", "PaymentMethod")]
public Esiur.Tests.RPC.EsiurServer.PaymentMethod Method { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Reference { get; set; }
[Annotation("DateTime")]
[Annotation("", "DateTime")]
public DateTime Timestamp { get; set; }
public SharedModel.Payment ToShared()
public Client.SharedModel.Payment ToShared()
{
return new SharedModel.Payment()
return new Client.SharedModel.Payment()
{
Amount = Amount,
Currency = Enum.Parse<SharedModel.Currency>(Currency.ToString(), true),
Method = Enum.Parse<SharedModel.PaymentMethod>(Method.ToString(), true),
Currency = Enum.Parse<Client.SharedModel.Currency>(Currency.ToString(), true),
Method = Enum.Parse<Client.SharedModel.PaymentMethod>(Method.ToString(), true),
Reference = Reference,
Timestamp = Timestamp,
Fee = Fee,
@@ -43,7 +43,7 @@ namespace RPC.EsiurTest
public Echo.ThriftModel.Payment ToThrift()
{
var rt= new Echo.ThriftModel.Payment()
var rt = new Echo.ThriftModel.Payment()
{
Amount = Amount,
Currency = Enum.Parse<Echo.ThriftModel.Currency>(Currency.ToString(), true),
@@ -58,14 +58,14 @@ namespace RPC.EsiurTest
return rt;
}
public Echo.Model.Grpc.Payment ToGrpc()
public Esiur.Tests.RPC.Client.Grpc.Payment ToGrpc()
{
return new Echo.Model.Grpc.Payment()
return new Esiur.Tests.RPC.Client.Grpc.Payment()
{
Amount = Amount,
Currency = Enum.Parse<Echo.Model.Grpc.Currency>(Currency.ToString(), true),
Currency = Enum.Parse<Esiur.Tests.RPC.Client.Grpc.Currency>(Currency.ToString(), true),
Fee = Fee ?? 0,
Method = Enum.Parse<Echo.Model.Grpc.PaymentMethod>(Method.ToString(), true),
Method = Enum.Parse<Esiur.Tests.RPC.Client.Grpc.PaymentMethod>(Method.ToString(), true),
Reference = Reference,
Timestamp = Timestamp.Ticks,
};
@@ -3,9 +3,9 @@ using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("fadfe3764f808d7e839fef5275490dd7")]
[Remote("Esiur.Tests.RPC.EsiurServer.PaymentMethod", "")]
[Export]
public enum PaymentMethod
{
@@ -14,6 +14,5 @@ namespace RPC.EsiurTest
Crypto = 3,
Other = 4,
Wire = 2
}
}
@@ -4,15 +4,14 @@ using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
#nullable enable
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
//{ab8e681b-61d9-8fb7-8c63-bbded15457e1}
[TypeId("f7e00be8881d88d68a8a2dc2d3a4b3d1")]
[Remote("Esiur.Tests.RPC.EsiurServer.Service", "")]
public class Service : EpResource
{
public Service(EpConnection connection, uint instanceId, ulong age, string link) : base(connection, instanceId, age, link) { }
public Service() { }
[Annotation("([Int32] count,[Int32] size,[Int32] delay) -> AsyncReply`1")]
[Annotation("", "([Int32] count,[Int32] size,[Int32] delay) -> AsyncReply`1")]
[Export]
public AsyncReply<byte[]> ChunkTest(int count, int size, int delay)
{
@@ -24,7 +23,7 @@ namespace RPC.EsiurTest
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Byte[]] payload) -> Byte[]")]
[Annotation("", "([Byte[]] payload) -> Byte[]")]
[Export]
public AsyncReply<byte[]> EchoBytes(byte[] payload)
{
@@ -36,31 +35,31 @@ namespace RPC.EsiurTest
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([BusinessDocument[]] payload) -> BusinessDocument[]")]
[Annotation("", "([BusinessDocument[]] payload) -> BusinessDocument[]")]
[Export]
public AsyncReply<RPC.EsiurTest.BusinessDocument[]> EchoDocuments(RPC.EsiurTest.BusinessDocument[] payload)
public AsyncReply<Esiur.Tests.RPC.EsiurServer.BusinessDocument[]> EchoDocuments(Esiur.Tests.RPC.EsiurServer.BusinessDocument[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<RPC.EsiurTest.BusinessDocument[]>();
var rt = new AsyncReply<Esiur.Tests.RPC.EsiurServer.BusinessDocument[]>();
_Invoke(2, args)
.Then(x => rt.Trigger((RPC.EsiurTest.BusinessDocument[])x))
.Then(x => rt.Trigger((Esiur.Tests.RPC.EsiurServer.BusinessDocument[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([DocType[]] payload) -> DocType[]")]
[Annotation("", "([DocType[]] payload) -> DocType[]")]
[Export]
public AsyncReply<RPC.EsiurTest.DocType[]> EchoEnumArray(RPC.EsiurTest.DocType[] payload)
public AsyncReply<Esiur.Tests.RPC.EsiurServer.DocType[]> EchoEnumArray(Esiur.Tests.RPC.EsiurServer.DocType[] payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<RPC.EsiurTest.DocType[]>();
var rt = new AsyncReply<Esiur.Tests.RPC.EsiurServer.DocType[]>();
_Invoke(3, args)
.Then(x => rt.Trigger((RPC.EsiurTest.DocType[])x))
.Then(x => rt.Trigger((Esiur.Tests.RPC.EsiurServer.DocType[])x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32[]] payload) -> Int32[]")]
[Annotation("", "([Int32[]] payload) -> Int32[]")]
[Export]
public AsyncReply<int[]> EchoIntArray(int[] payload)
{
@@ -72,19 +71,19 @@ namespace RPC.EsiurTest
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Map`2] payload) -> Map`2")]
[Annotation("", "([Map`2] payload) -> Map`2")]
[Export]
public AsyncReply<Map<string, RPC.EsiurTest.BusinessDocument>> EchoMap(Map<string, RPC.EsiurTest.BusinessDocument> payload)
public AsyncReply<Map<string, Esiur.Tests.RPC.EsiurServer.BusinessDocument>> EchoMap(Map<string, Esiur.Tests.RPC.EsiurServer.BusinessDocument> payload)
{
var args = new Map<byte, object>() { [0] = payload };
var rt = new AsyncReply<Map<string, RPC.EsiurTest.BusinessDocument>>();
var rt = new AsyncReply<Map<string, Esiur.Tests.RPC.EsiurServer.BusinessDocument>>();
_Invoke(5, args)
.Then(x => rt.Trigger((Map<string, RPC.EsiurTest.BusinessDocument>)x))
.Then(x => rt.Trigger((Map<string, Esiur.Tests.RPC.EsiurServer.BusinessDocument>)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([String[]] payload) -> String[]")]
[Annotation("", "([String[]] payload) -> String[]")]
[Export]
public AsyncReply<string[]> EchoStringArray(string[] payload)
{
@@ -96,7 +95,7 @@ namespace RPC.EsiurTest
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] count,[Int32] size,[Int32] delay) -> Void")]
[Annotation("", "([Int32] count,[Int32] size,[Int32] delay) -> Void")]
[Export]
public AsyncReply<object> EventTest(int count, int size, int delay)
{
@@ -108,7 +107,7 @@ namespace RPC.EsiurTest
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] count,[Int32] size,[Int32] delay) -> Void")]
[Annotation("", "([Int32] count,[Int32] size,[Int32] delay) -> Void")]
[Export]
public AsyncReply<object> PropertyChangeTest(int count, int size, int delay)
{
@@ -120,62 +119,62 @@ namespace RPC.EsiurTest
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] localProbability,[Double] remoteProbability,[String] remoteHostLink) -> AsyncReply`1")]
[Annotation("", "([Int32] interval,[Int32] count,[Double] localProbability,[Double] remoteProbability,[String] remoteHostLink) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdates(int interval, int count, double localProbability, double remoteProbability, string remoteHostLink)
public AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject> StartUpdates(int interval, int count, double localProbability, double remoteProbability, string remoteHostLink)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = localProbability, [3] = remoteProbability, [4] = remoteHostLink };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
var rt = new AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject>();
_Invoke(9, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Then(x => rt.Trigger((Esiur.Tests.RPC.EsiurServer.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] localProbability) -> AsyncReply`1")]
[Annotation("", "([Int32] interval,[Int32] count,[Double] localProbability) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdatesLocal(int interval, int count, double localProbability)
public AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject> StartUpdatesLocal(int interval, int count, double localProbability)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = localProbability };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
var rt = new AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject>();
_Invoke(10, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Then(x => rt.Trigger((Esiur.Tests.RPC.EsiurServer.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] remoteProbability,[String] remoteNode,[String] remoteLink) -> AsyncReply`1")]
[Annotation("", "([Int32] interval,[Int32] count,[Double] remoteProbability,[String] remoteNode,[String] remoteLink) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdatesMirror(int interval, int count, double remoteProbability, string remoteNode, string remoteLink)
public AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject> StartUpdatesMirror(int interval, int count, double remoteProbability, string remoteNode, string remoteLink)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = remoteProbability, [3] = remoteNode, [4] = remoteLink };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
var rt = new AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject>();
_Invoke(11, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Then(x => rt.Trigger((Esiur.Tests.RPC.EsiurServer.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("([Int32] interval,[Int32] count,[Double] remoteProbability,[String] remoteLink) -> AsyncReply`1")]
[Annotation("", "([Int32] interval,[Int32] count,[Double] remoteProbability,[String] remoteLink) -> AsyncReply`1")]
[Export]
public AsyncReply<RPC.EsiurTest.TestObject> StartUpdatesRemote(int interval, int count, double remoteProbability, string remoteLink)
public AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject> StartUpdatesRemote(int interval, int count, double remoteProbability, string remoteLink)
{
var args = new Map<byte, object>() { [0] = interval, [1] = count, [2] = remoteProbability, [3] = remoteLink };
var rt = new AsyncReply<RPC.EsiurTest.TestObject>();
var rt = new AsyncReply<Esiur.Tests.RPC.EsiurServer.TestObject>();
_Invoke(12, args)
.Then(x => rt.Trigger((RPC.EsiurTest.TestObject)x))
.Then(x => rt.Trigger((Esiur.Tests.RPC.EsiurServer.TestObject)x))
.Error(x => rt.TriggerError(x))
.Chunk(x => rt.TriggerChunk(x));
return rt;
}
[Annotation("Byte[]")]
[Annotation("", "Byte[]")]
[Export]
public byte[] MessageToChange
{
get => (byte[])_properties[0];
set => SetResourceProperty(0, value);
}
[Annotation("Object")]
[Annotation("", "Object")]
[Export]
public object TestProperty
{
@@ -4,32 +4,32 @@ using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
#nullable enable
namespace RPC.EsiurTest
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("d90d3558e2b18d9a8f45707372ddf2c3")]
[Remote("Esiur.Tests.RPC.EsiurServer.TestObject", "")]
public class TestObject : EpResource
{
public TestObject(EpConnection connection, uint instanceId, ulong age, string link) : base(connection, instanceId, age, link) { }
public TestObject() { }
[Annotation("String")]
[Annotation("", "String")]
[Export]
public string Name
{
get => (string)properties[0];
get => (string)_properties[0];
set => SetResourceProperty(0, value);
}
[Annotation("Int32")]
[Annotation("", "Int32")]
[Export]
public int Size
{
get => (int)properties[1];
get => (int)_properties[1];
set => SetResourceProperty(1, value);
}
[Annotation("Object")]
[Annotation("", "Object")]
[Export]
public object Value
{
get => (object)properties[2];
get => (object)_properties[2];
set => SetResourceProperty(2, value);
}
@@ -1,46 +1,47 @@
using System;
using Esiur.Resource;
using Esiur.Core;
using Esiur.Data;
using Esiur.Protocol;
using Esiur.Resource;
using Google.Protobuf;
namespace RPC.EsiurTest
using System;
namespace Esiur.Tests.RPC.EsiurServer
{
[TypeId("91ed22c5c53e846181f799dc76ddd93c")]
[Remote("Esiur.Tests.RPC.EsiurServer.Variant", "")]
[Export]
public class Variant : IRecord
{
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public bool? Bool { get; set; }
[Annotation("Byte[]")]
[Annotation("", "Byte[]")]
public byte[] Bytes { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public DateTime? Dt { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public double? F64 { get; set; }
[Annotation("Byte[]")]
[Annotation("", "Byte[]")]
public byte[] Guid { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public long? I64 { get; set; }
[Annotation("String")]
[Annotation("", "String")]
public string Str { get; set; }
[Annotation("Kind")]
public RPC.EsiurTest.Kind Tag { get; set; }
[Annotation("", "Kind")]
public Esiur.Tests.RPC.EsiurServer.Kind Tag { get; set; }
[Annotation("Nullable`1?")]
[Annotation("", "Nullable`1?")]
public ulong? U64 { get; set; }
public RPC.SharedModel.Variant ToShared()
public Client.SharedModel.Variant ToShared()
{
return new SharedModel.Variant()
return new Client.SharedModel.Variant()
{
Bool = Bool,
@@ -50,14 +51,14 @@ namespace RPC.EsiurTest
Guid = Guid,
I64 = I64,
Str = Str,
Tag = Enum.Parse<SharedModel.Kind>(Tag.ToString(), true),
Tag = Enum.Parse<Client.SharedModel.Kind>(Tag.ToString(), true),
U64 = U64
};
}
public Echo.Model.Grpc.Variant ToGrpc()
public Client.Grpc.Variant ToGrpc()
{
return new Echo.Model.Grpc.Variant()
return new Client.Grpc.Variant()
{
BoolVal = Bool ?? false,
BytesVal = ByteString.CopyFrom(Bytes ?? new byte[0]),
@@ -66,7 +67,7 @@ namespace RPC.EsiurTest
GuidVal = ByteString.CopyFrom(Guid ?? new byte[0]),
I64Val = I64 ?? 0,
StrVal = Str,
Tag = Enum.Parse<Echo.Model.Grpc.Kind>(Tag.ToString(), true),
Tag = Enum.Parse<Client.Grpc.Kind>(Tag.ToString(), true),
U64Val = U64 ?? 0,
};
}
+8
View File
@@ -0,0 +1,8 @@
using System;
namespace Esiur {
public static class Generated {
public static Type[] Resources {get;} = new Type[] { typeof(Esiur.Tests.RPC.EsiurServer.Service),typeof(Esiur.Tests.RPC.EsiurServer.TestObject) };
public static Type[] Records { get; } = new Type[] { typeof(Esiur.Tests.RPC.EsiurServer.BusinessDocument),typeof(Esiur.Tests.RPC.EsiurServer.Attachment),typeof(Esiur.Tests.RPC.EsiurServer.Party),typeof(Esiur.Tests.RPC.EsiurServer.Address),typeof(Esiur.Tests.RPC.EsiurServer.DocumentHeader),typeof(Esiur.Tests.RPC.EsiurServer.LineItem),typeof(Esiur.Tests.RPC.EsiurServer.Variant),typeof(Esiur.Tests.RPC.EsiurServer.Payment) };
public static Type[] Enums { get; } = new Type[] { typeof(Esiur.Tests.RPC.EsiurServer.Currency),typeof(Esiur.Tests.RPC.EsiurServer.DocType),typeof(Esiur.Tests.RPC.EsiurServer.Kind),typeof(Esiur.Tests.RPC.EsiurServer.LineType),typeof(Esiur.Tests.RPC.EsiurServer.PaymentMethod) };
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
namespace RPC.SharedModel
namespace Esiur.Tests.RPC.Client.SharedModel
{
// ====================== Enums ======================
+1 -1
View File
@@ -2,7 +2,7 @@
package gpmodel;
option csharp_namespace = "Echo.Model.Grpc";
option csharp_namespace = "Esiur.Tests.RPC.Client.Grpc";
// ========================= Enums =========================