From 41cd161947d4263e50fe7c70046366d4ee089d32 Mon Sep 17 00:00:00 2001 From: Gutemberg Ribeiro Date: Sun, 5 Nov 2017 11:53:48 -0200 Subject: [PATCH] Initial readme (#2) * Initial Readme.md * Basic readme --- README.md | 65 +++++++++++++++++++++++++++++++ src/SignalR.Orleans/Extensions.cs | 14 +++---- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 60534c20..9fb07858 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,68 @@ +

+ SignalR.Orleans +

SignalR.Orleans

+

+ [![Build status](https://projectappengine.visualstudio.com/_apis/public/build/definitions/66fe6898-2b40-410a-b05d-893a610d2ccb/1/badge)](https://projectappengine.visualstudio.com/_apis/public/build/definitions/66fe6898-2b40-410a-b05d-893a610d2ccb/1/badge) [![NuGet](https://img.shields.io/nuget/v/SignalR.Orleans.svg?style=flat)](http://www.nuget.org/profiles/SignalR.Orleans) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotnet/orleans?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +[Orleans](https://github.com/dotnet/orleans) is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns. + +[ASP.NET Core SignalR](https://github.com/aspnet/SignalR) is a new library for ASP.NET Core developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time. + +**SignalR.Orleans** is a package that allow us to enhance the _real-time_ capabilities of SignalR by leveraging Orleans distributed cloud platform capabilities. + + +Installation +============ + +Installation is performed via [NuGet](https://www.nuget.org/packages/SignalR.Orleans/) + +From Package Manager: + +> Install-Package SignalR.Orleans -Version 1.0.0-preview-1 + +.Net CLI: + +> dotnet add package SignalR.Orleans --version 1.0.0-preview-1 + +Packet: + +> paket add SignalR.Orleans --version 1.0.0-preview-1 + + +Code Examples +============= + +At SignalR application configuration (`ISignalRBuilder`): + +```c# +signalRBuilder.AddOrleans(); +``` + +In your Orleans Client configuration (`ClientConfiguration`): + +```c# +clientConfiguration.AddSignalR(); +``` + +In your Orleans client builder (`IClientBuilder`): + +```c# +clientBuilder.UseSignalR(); +``` + +In your Orleans silo builder (`ISiloHostBuilder`): + +```c# +siloBuilder..UseSignalR(); +``` + +In your Orleans cluster configuration (`ClusterConfiguration`): + +```c# +clusterConfiguration.AddSignalR(); +``` + +PRs and feedback is **very** welcome! diff --git a/src/SignalR.Orleans/Extensions.cs b/src/SignalR.Orleans/Extensions.cs index a9550d7d..ea1dba98 100644 --- a/src/SignalR.Orleans/Extensions.cs +++ b/src/SignalR.Orleans/Extensions.cs @@ -12,7 +12,7 @@ namespace Microsoft.Extensions.DependencyInjection { public static class OrleansDependencyInjectionExtensions { - public static ClusterConfiguration AddOrleansSignalR(this ClusterConfiguration config) + public static ClusterConfiguration AddSignalR(this ClusterConfiguration config) { config.Globals.SerializationProviders.Add(typeof(HubMessageSerializer).GetTypeInfo()); config.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER); @@ -20,41 +20,41 @@ public static ClusterConfiguration AddOrleansSignalR(this ClusterConfiguration c return config; } - public static ClientConfiguration AddOrleansSignalR(this ClientConfiguration config) + public static ClientConfiguration AddSignalR(this ClientConfiguration config) { config.SerializationProviders.Add(typeof(HubMessageSerializer).GetTypeInfo()); config.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER); return config; } - public static ISiloHostBuilder UseOrleansSignalR(this ISiloHostBuilder builder) + public static ISiloHostBuilder UseSignalR(this ISiloHostBuilder builder) { return builder .AddApplicationPartsFromReferences(typeof(ClientGrain).Assembly) .AddApplicationPartsFromReferences(typeof(GroupGrain).Assembly); } - public static IClientBuilder UseOrleansSignalR(this IClientBuilder builder) + public static IClientBuilder UseSignalR(this IClientBuilder builder) { return builder .AddApplicationPartsFromReferences(typeof(IClientGrain).Assembly) .AddApplicationPartsFromReferences(typeof(IGroupGrain).Assembly); } - public static ISignalRBuilder AddOrleansSignalR(this ISignalRBuilder builder, IClientBuilder clientBuilder) + public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder, IClientBuilder clientBuilder) { var client = clientBuilder.Build(); client.Connect().Wait(); return builder.AddOrleansSignalR(client); } - public static ISignalRBuilder AddOrleansSignalR(this ISignalRBuilder builder, IClusterClient clusterClient) + public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder, IClusterClient clusterClient) { builder.Services.AddSingleton(typeof(IClusterClient), clusterClient); return builder.AddOrleansSignalR(); } - public static ISignalRBuilder AddOrleansSignalR(this ISignalRBuilder builder) + public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder) { builder.Services.AddSingleton(typeof(HubLifetimeManager<>), typeof(OrleansHubLifetimeManager<>)); return builder;