Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create Hub and new route at run-time using Roslyn scripting? #5335

Closed
fastrocket opened this issue Aug 30, 2018 · 3 comments
Closed
Labels
area-signalr Includes: SignalR clients and servers
Milestone

Comments

@fastrocket
Copy link

In my ASP.NET Core 2.1 application, users can create new classes and types at run-time using Roslyn scripting. With that in mind, I'm trying to create a new Hub with a method that can handle this new type (input and output). I can't use generics since they are a compile-time construct.

I believe the "new" hub will also need to be instantiated via Roslyn scripting. The reason for this is I want a strongly typed Hub and Client for performance reasons. (The strongly-typed C# client can be instantiated via Roslyn.)

However, hubs and their routes need to be declared in Startup.cs which is essentially compile-time.

One other consideration is using a hub that uses the "dynamic" type. But this is slower than using a strongly-typed type, and could require boxing/unboxing of value types.

Any pointers would be appreciated since I have searched the web and docs to no avail. Thanks!

@analogrelay
Copy link
Contributor

We don't currently have any built-in support for dynamic discovery of Hubs. The Hubs are discovered once at startup and loaded into the DI container.

@fastrocket
Copy link
Author

Thanks for that answer. Do you or anybody else have an idea for a work-around?

And if I wanted to hack the source to add this ability, where would you suggest I start looking?

@aspnet-hello aspnet-hello transferred this issue from aspnet/SignalR Dec 17, 2018
@aspnet-hello aspnet-hello added this to the Discussions milestone Dec 17, 2018
@aspnet-hello aspnet-hello added the area-signalr Includes: SignalR clients and servers label Dec 17, 2018
@aspnet-hello
Copy link

We periodically close 'discussion' issues that have not been updated in a long period of time.

We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

@dotnet dotnet locked and limited conversation to collaborators Mar 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

3 participants