mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-26 21:13:13 +00:00
Generics workaround
This commit is contained in:
@ -19,6 +19,15 @@ public enum SizeEnum:short
|
||||
XLarge = 22
|
||||
}
|
||||
|
||||
|
||||
public class SearchResults<T> : IRecord where T : IResource
|
||||
{
|
||||
[Public] public int Offset { get; set; }
|
||||
[Public] public int Needed { get; set; }
|
||||
[Public] public int Total { get; set; }
|
||||
[Public] public T[] Results { get; set; }
|
||||
}
|
||||
|
||||
[Resource]
|
||||
public partial class MyService
|
||||
{
|
||||
@ -29,6 +38,12 @@ public partial class MyService
|
||||
[Public] bool boolean = true;
|
||||
[Public] bool[] booleanArray = new bool[] { true, false, true, false, true };
|
||||
|
||||
[Public]
|
||||
public SearchResults<MyResource> GetRecords()
|
||||
{
|
||||
return new SearchResults<MyResource>() { Needed = 3, Offset = 10, Results = new MyResource[0], Total = 102 };
|
||||
}
|
||||
|
||||
[Public] byte uInt8Test = 8;
|
||||
[Public] byte? uInt8Null = null;
|
||||
[Public] byte[] uInt8Array = new byte[] { 0, 1, 2, 3, 4, 5 };
|
||||
@ -124,7 +139,7 @@ public partial class MyService
|
||||
[Public] public IResource[] Resources { get; set; }
|
||||
|
||||
[Public]
|
||||
public void Void() =>
|
||||
public void Void() =>
|
||||
Console.WriteLine("Void()");
|
||||
|
||||
[Public]
|
||||
@ -159,7 +174,8 @@ public partial class MyService
|
||||
[Public]
|
||||
public (int, string, double, bool) GetTuple4(int a1, string a2, double a3, bool a4) => (a1, a2, a3, a4);
|
||||
|
||||
[Public] public MyRecord SendRecord(MyRecord record)
|
||||
[Public]
|
||||
public MyRecord SendRecord(MyRecord record)
|
||||
{
|
||||
Console.WriteLine(record.ToString());
|
||||
return record;
|
||||
|
@ -45,6 +45,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
|
||||
|
||||
|
||||
class Program
|
||||
{
|
||||
|
||||
@ -64,7 +67,7 @@ namespace Test
|
||||
|
||||
service.Resource = res1;
|
||||
service.ChildResource = res3;
|
||||
service.Resources = new MyResource[] { res1, res2, res1 , res3 };
|
||||
service.Resources = new MyResource[] { res1, res2, res1, res3 };
|
||||
|
||||
//web.MapGet("/{action}/{age}", (int age, string action, HTTPConnection sender) =>
|
||||
//{
|
||||
@ -86,25 +89,18 @@ namespace Test
|
||||
}
|
||||
|
||||
|
||||
enum aa
|
||||
{
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d
|
||||
}
|
||||
|
||||
public static (int, string) tuple() => (33, "sss");
|
||||
|
||||
private static async void TestClient(IResource local)
|
||||
{
|
||||
dynamic remote = await Warehouse.Get<IResource>("iip://localhost/mem/service");
|
||||
|
||||
TestObjectProps(local, remote);
|
||||
var r = await remote.GetRecords();
|
||||
|
||||
var opt = await remote.Optional(new { a1 = 22, a2 = 33, a4 = "What?" });
|
||||
Console.WriteLine(opt);
|
||||
|
||||
|
||||
await remote.Void();
|
||||
await remote.Connection("ss", 33);
|
||||
await remote.ConnectionOptional("Test 2", 88);
|
||||
|
Reference in New Issue
Block a user