mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-06-26 21:13:13 +00:00
Static Calling
This commit is contained in:
@ -37,6 +37,8 @@ public partial class MyService
|
||||
return new MyGenericRecord<MyResource>() { Needed = 3, Start = 10, Results = new MyResource[0], Total = 102 };
|
||||
}
|
||||
|
||||
[Public] public static string staticFunction(string name) => $"Hello {name}";
|
||||
|
||||
[Public] byte uInt8Test = 8;
|
||||
[Public] byte? uInt8Null = null;
|
||||
[Public] byte[] uInt8Array = new byte[] { 0, 1, 2, 3, 4, 5 };
|
||||
|
@ -57,7 +57,14 @@ namespace Test
|
||||
// Create stores to keep objects.
|
||||
var system = await Warehouse.Put("sys", new MemoryStore());
|
||||
var server = await Warehouse.Put("sys/server", new DistributedServer());
|
||||
var web = await Warehouse.Put("sys/web", new HTTPServer() { Port = 8888});
|
||||
|
||||
server.MapCall("Hello", (string msg, DateTime time, DistributedConnection sender) =>
|
||||
{
|
||||
Console.WriteLine(msg);
|
||||
return "Hi " + DateTime.UtcNow;
|
||||
});
|
||||
|
||||
var web = await Warehouse.Put("sys/web", new HTTPServer() { Port = 8088});
|
||||
|
||||
var service = await Warehouse.Put("sys/service", new MyService());
|
||||
var res1 = await Warehouse.Put("sys/service/r1", new MyResource() { Description = "Testing 1", CategoryId = 10 });
|
||||
@ -95,6 +102,9 @@ namespace Test
|
||||
dynamic remote = await Warehouse.Get<IResource>("iip://localhost/sys/service");
|
||||
|
||||
var con = remote.Connection as DistributedConnection;
|
||||
|
||||
var pcall = await con.Call("Hello", "whats up ?", DateTime.UtcNow);
|
||||
|
||||
var template = await con.GetTemplateByClassName("Test.MyResource");
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user