dsuryd / dotNetify

Simple, lightweight, yet powerful way to build real-time web apps.
https://dotnetify.net
Other
1.17k stars 164 forks source link

Is it required to use AddControllersAsServices? #311

Closed HengzheLi closed 2 years ago

HengzheLi commented 2 years ago

I am using OchardCore and Dotnetify to build my application. But it seems they are not compatible because of the way of controller activation. Refer to https://github.com/dsuryd/dotNetify/blob/fa00c472c5c1c1eee809205d3b166dc748972568/DotNetifyLib.SignalR/Extensions/ServiceCollectionExtensions.cs#L69 Dotnetify changes the MVC to use DI to activate the controller. But none of OrchardCore's controller is registered into DI. So is it required to use AddControllersAsServices here? Can dotnetify provide a workaround to use MVC default controller activator?

dsuryd commented 2 years ago

It's not required if not using dotNetify web API. I suppose we can pass an 'enableWebApi' flag to the method to skip that line. You're welcome to send a pull request.

HengzheLi commented 2 years ago

OK. So it won't impact the usage right? What will be missed if dotNetify web API is skipped?

dsuryd commented 2 years ago

Just this: https://dotnetify.net/core/api/webapimode

HengzheLi commented 2 years ago

@dsuryd here is the PR https://github.com/dsuryd/dotNetify/pull/312 will release a new version of nuget package when pr is merged