Revisions

This commit is contained in:
2026-08-09 03:54:28 +03:00
parent 2028db671f
commit 3b55d8d2f8
37 changed files with 1743 additions and 230 deletions
+10 -17
View File
@@ -89,17 +89,17 @@ Now we can add our resource to the memory store using `warehouse.Put`.
await warehouse.Put("sys/hello", new HelloResource());
```
Add an `EpServer` to expose the resource through the Esiur EP protocol. Anonymous access is enabled here only to make the development example easy to run; production applications should configure an authentication provider.
Add an `EpServer` to expose the resource through the Esiur EP protocol. The
server and portless `ep://` client URLs use port `51018` by default; set
`EpServer.Port` or include a URL port only when an application needs an
override. Anonymous access is enabled here only to make the development
example easy to run; production applications should configure an
authentication provider.
```C#
var epPort = ushort.Parse(
Environment.GetEnvironmentVariable("ESIUR_PORT")
?? throw new InvalidOperationException("Set ESIUR_PORT."));
await warehouse.Put("sys/server", new EpServer
{
Port = epPort,
AllowUnauthorizedAccess = true, // Development only.
});
```
@@ -118,15 +118,11 @@ To sum up
>using Esiur.Resource;
>using Esiur.Stores;
>
>var epPort = ushort.Parse(
> Environment.GetEnvironmentVariable("ESIUR_PORT")
> ?? throw new InvalidOperationException("Set ESIUR_PORT."));
>var warehouse = new Warehouse();
>await warehouse.Put("sys", new MemoryStore());
>await warehouse.Put("sys/hello", new HelloResource());
>await warehouse.Put("sys/server", new EpServer
>{
> Port = epPort,
> AllowUnauthorizedAccess = true, // Development only.
>});
>await warehouse.Open();
@@ -138,8 +134,7 @@ To access our resource remotely, we need to use it's full path including the pro
```C#
var warehouse = new Warehouse();
var epPort = ushort.Parse(Environment.GetEnvironmentVariable("ESIUR_PORT")!);
dynamic res = await warehouse.Get<IResource>($"ep://localhost:{epPort}/sys/hello");
dynamic res = await warehouse.Get<IResource>("ep://localhost/sys/hello");
```
Now we can invoke the exported functions and read/write properties;
@@ -157,8 +152,7 @@ Summing up
>using Esiur.Resource;
>
>var warehouse = new Warehouse();
>var epPort = ushort.Parse(Environment.GetEnvironmentVariable("ESIUR_PORT")!);
>dynamic res = await warehouse.Get<IResource>($"ep://localhost:{epPort}/sys/hello");
>dynamic res = await warehouse.Get<IResource>("ep://localhost/sys/hello");
>
>var reply = await res.SayHi("Hi, I'm calling you from dotnet");
>
@@ -176,7 +170,7 @@ Esiur has a self describing feature which comes with every language it supports,
After installing the Esiur NuGet package, a new command named ***Get-Types*** is added to the Visual Studio Package Manager Console. It generates client-side classes for robust static typing.
```ps
Get-Types "ep://localhost:$env:ESIUR_PORT/sys/hello"
Get-Types "ep://localhost/sys/hello"
```
This will generate and add wrappers for all types needed by our resource.
@@ -184,8 +178,7 @@ This will generate and add wrappers for all types needed by our resource.
Allowing us to use
```C#
var warehouse = new Warehouse();
var epPort = ushort.Parse(Environment.GetEnvironmentVariable("ESIUR_PORT")!);
var res = await warehouse.Get<MyResource>($"ep://localhost:{epPort}/sys/hello");
var res = await warehouse.Get<MyResource>("ep://localhost/sys/hello");
var reply = await res.SayHi("Static typing is better");
Console.WriteLine(reply);
```