From 6cae4b3086ce5e7db960a4838874d4063cc2871b Mon Sep 17 00:00:00 2001 From: Ahmed Zamil Date: Sat, 12 Oct 2024 14:06:08 +0300 Subject: [PATCH] ASP.Net --- Esiur.AspNetCore/Esiur.AspNetCore.csproj | 51 +++++++++++++----------- Esiur.AspNetCore/README.md | 51 ++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 24 deletions(-) create mode 100644 Esiur.AspNetCore/README.md diff --git a/Esiur.AspNetCore/Esiur.AspNetCore.csproj b/Esiur.AspNetCore/Esiur.AspNetCore.csproj index b796dd9..2576463 100644 --- a/Esiur.AspNetCore/Esiur.AspNetCore.csproj +++ b/Esiur.AspNetCore/Esiur.AspNetCore.csproj @@ -1,32 +1,35 @@  - - Esiur distributed resource framework support for ASP.Net - Ahmed Kh. Zamil - http://www.esiur.com - true - 1.0.0 - Ahmed Kh. Zamil - Esiur Foundation + + Esiur distributed resource framework support for ASP.Net + Ahmed Kh. Zamil + http://www.esiur.com + true + 1.0.0 + Ahmed Kh. Zamil + Esiur Foundation - https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE - http://www.esiur.com - https://github.com/esiur/esiur-dotnet/ + http://www.esiur.com + https://github.com/esiur/esiur-dotnet/ - net8.0 - enable - enable - Esiur ASP.Net Middleware - + README.md + MIT - - - - - + net8.0 + enable + enable + Esiur ASP.Net Middleware + - - - + + + + + + + + + + diff --git a/Esiur.AspNetCore/README.md b/Esiur.AspNetCore/README.md new file mode 100644 index 0000000..e7b1915 --- /dev/null +++ b/Esiur.AspNetCore/README.md @@ -0,0 +1,51 @@ +# Esiur ASP.Net Core Middleware + +This project brings Esiur distributed resource framework to ASP.Net using WebSockets in the ASP.Net pipeline. +# Installation +- Nuget +```Install-Package Esiur.AspNetCore``` +- Command-line +``` dotnet add package Esiur.AspNetCore ``` +# Example +```C# +var builder = WebApplication.CreateBuilder(args); +builder.WebHost.UseUrls("http://localhost:8080"); +var app = builder.Build(); + +app.UseWebSockets(); + +await Warehouse.Put("sys", new MemoryStore()); +await Warehouse.Put("sys/service", new MyResource()); +var server = await Warehouse.Put("sys/server", new DistributedServer()); +await Warehouse.Open(); + +app.UseEsiur(new EsiurOptions() { Server = server }); + +await app.RunAsync(); +``` + +## MyResource.cs + +```c# + [Resource] + public partial class MyResource + { + [Export] int number; + [Export] public string Hello() => "Hi"; + } +``` + + +## Calling from JavaScript + +Esiur provides a command line interpreter for debugging using Node.JS which can be installed using +```npm install -g esiur``` + +To access the shell +```esiur shell``` + +Now you can simply test the running service typing +```javascript +let x = await wh.get("iip://localhost:8080/sys/service", {secure: false}); +await x.Hello(); +```