简体   繁体   English

在ASP.NET Boilerplate中重写SignalR Contract Resolver

[英]Overriding SignalR Contract Resolver in ASP.NET Boilerplate

I'm having an issue where methods called in a signal R hub are returning camel cased. 我遇到一个问题,其中信号R集线器中调用的方法返回使用驼峰的情况。 I see in the boilerplate documentation there is a section in signalR on how to override the default behavior 我在样板文档中看到在signalR中有一个有关如何覆盖默认行为的部分

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

I can't figure out how to implement this correctly. 我不知道如何正确实现这一点。 I've tried adding the below snippet to the Startup.cs before and after app.MapSignalR(). 我尝试在app.MapSignalR()之前和之后将以下代码段添加到Startup.cs中。 I've tried adding it to the Pre-initialize of the web module, I've added all of my assemblies; 我尝试将其添加到Web模块的预初始化中,添加了所有程序集; I'm out of ideas. 我没主意了。

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

I'm using .NET 4.6.x, ABP Version 3.2.4 我正在使用.NET 4.6.x,ABP版本3.2.4

If the type that you want to use the default contract resolver for is in that module then you're good to go but if you're using a third part library outside of the module then you to make sure that is added to the list. 如果要使用默认合同解析器的类型在该模块中,则可以使用,但如果您在模块外部使用第三方库,则请确保将其添加到列表中。 From what I can tell the code that you have above should work it's just a matter of making sure the right types are added. 据我所知,上面的代码应该可以工作,只是确保添加了正确的类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM