forked from OrleansContrib/SignalR.Orleans
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(all): upgrade to
Olreans RC1
(OrleansContrib#25)
* feat(all): upgrade to `olreans RC1` * extensions: revert `AddApplicationPart` change * extensions: add `WithReferences` on `AddApplicationPart`
- Loading branch information
1 parent
7bc667c
commit 8902398
Showing
5 changed files
with
42 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,32 @@ | ||
using System.Reflection; | ||
using Microsoft.AspNetCore.SignalR; | ||
using Orleans; | ||
using Orleans.Hosting; | ||
using Orleans.Runtime.Configuration; | ||
using SignalR.Orleans; | ||
using SignalR.Orleans.Clients; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
public static class OrleansServerExtensions | ||
{ | ||
public static ClusterConfiguration AddSignalR(this ClusterConfiguration config) | ||
{ | ||
config.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER); | ||
try | ||
{ | ||
config.AddMemoryStorageProvider("PubSubStore"); | ||
} | ||
catch | ||
{ | ||
// PubSubStore was already added. Do nothing. | ||
} | ||
config.AddMemoryStorageProvider(Constants.STORAGE_PROVIDER); | ||
return config; | ||
} | ||
|
||
public static ISiloHostBuilder UseSignalR(this ISiloHostBuilder builder) | ||
{ | ||
return builder.ConfigureApplicationParts(mgr => | ||
mgr.AddApplicationPart(typeof(ClientGrain).Assembly)); | ||
try { builder = builder.AddMemoryGrainStorage("PubSubStore"); } | ||
catch { /** PubSubStore was already added. Do nothing. **/ } | ||
|
||
return builder.AddMemoryGrainStorage(Constants.STORAGE_PROVIDER) | ||
.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER) | ||
.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(ClientGrain).Assembly).WithReferences()); | ||
} | ||
} | ||
|
||
public static class OrleansClientExtensions | ||
{ | ||
public static ClientConfiguration AddSignalR(this ClientConfiguration config) | ||
{ | ||
config.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER); | ||
return config; | ||
} | ||
|
||
public static IClientBuilder UseSignalR(this IClientBuilder builder) | ||
{ | ||
return builder.ConfigureApplicationParts(mgr => | ||
mgr.AddApplicationPart(typeof(IClientGrain).Assembly)); | ||
} | ||
|
||
public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder) | ||
{ | ||
builder.Services.AddSingleton(typeof(HubLifetimeManager<>), typeof(OrleansHubLifetimeManager<>)); | ||
return builder; | ||
return builder.AddSimpleMessageStreamProvider(Constants.STREAM_PROVIDER) | ||
.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IClientGrain).Assembly).WithReferences()) | ||
.ConfigureServices(services => services.AddSingleton(typeof(HubLifetimeManager<>), typeof(OrleansHubLifetimeManager<>))); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters