Base solution for your next web application
Open Closed

Overriding contract resolver for Signal R hub #4559


User avatar
0
fgarcia created

I'm having an issue where methods called in a signal R hub are returning camel cased. I see in the boilerplate documentation there is a section in signalR on how to override the default behavior

[https://aspnetboilerplate.com/Pages/Documents/SignalR-Integration#pascalcase-vs-camelcase])

I can't figure out how to implement this correctly. I've added the below snippet in the Startup.cs before and after app.MapSignalR(). I've added it to the Pre-initialize of the web module, I've added all of my assemblies; I'm out of ideas.

AbpSignalRContractResolver.IgnoredAssemblies.Add(typeof(MyWebModule).Assembly);

Please advise, thanks!


6 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Do you want to return PascalCase or camelCase?

  • User Avatar
    0
    fgarcia created

    Pascal case please

  • User Avatar
    0
    aaron created
    Support Team

    For all methods or just SignalR Hub?

  • User Avatar
    0
    fgarcia created

    Just the Signal R hub. I need to keep the camel case resolver for the prebuilt ASPNetZero stuff, and I already have an Action filter I add to the IAppService interfaces that replaced the contract resolver on a per action basis, but the SignalR hub is overriding that behavior. I tried to tie in to the HubPipeline with a module that tried to catch OnBeforeOutgoing but that didn't seem to work as I expected. Since there is a block of text in the documentation referring to this very issue, I assumed there would be some 'correct' way of doing what I'm trying to do in ABP.

  • User Avatar
    0
    fgarcia created

    It turns out we were using the feature correctly, but the type that wasn't getting pascal cased was a wrapper in a third party library, which wasn't getting ignored. Adding that to the block of assemblies to ignore worked perfectly.

  • User Avatar
    0
    aaron created
    Support Team