irabbitmqbusfactoryconfigurator.configurejsonserializer在MassTransit RabbitMQ中的8.0.3中的configurejsonserializer在哪里?
我们从MassTransit 7.0.6升级到8.0.3
之前,我们正在配置configureJsonSerializer
。但这似乎从8.0.3版本中删除。源代码下面
x.UsingRabbitMq((context, cfg) =>
{
cfg.Host(Config.GetValue<string>("RabbitMQ:Host"), "/", h =>
{
h.Username(Config.GetValue<string>("RabbitMQ:Username"));
h.Password(Config.GetValue<string>("RabbitMQ:Password"));
});
cfg.ConfigureEndpoints(context);
cfg.ConfigureJsonSerializer(settings => { settings.DefaultValueHandling = DefaultValueHandling.Include; return settings; });
});
我们如何替换configurejsonserializer
和DefaultValueHandling
?
我看到
cfg.UseJsonSerializer();
cfg.ConfigureJsonSerializerOptions(options => options.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.???);
这会是正确的替换,哪个defaultignorecondition
?
We upgraded from Masstransit 7.0.6 to 8.0.3
Previously we were configuring ConfigureJsonSerializer
. But this seems removed from version 8.0.3. Source code below
x.UsingRabbitMq((context, cfg) =>
{
cfg.Host(Config.GetValue<string>("RabbitMQ:Host"), "/", h =>
{
h.Username(Config.GetValue<string>("RabbitMQ:Username"));
h.Password(Config.GetValue<string>("RabbitMQ:Password"));
});
cfg.ConfigureEndpoints(context);
cfg.ConfigureJsonSerializer(settings => { settings.DefaultValueHandling = DefaultValueHandling.Include; return settings; });
});
How do we replace ConfigureJsonSerializer
and DefaultValueHandling
?
I see there is
cfg.UseJsonSerializer();
cfg.ConfigureJsonSerializerOptions(options => options.DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.???);
would this be the correct replacement and which DefaultIgnoreCondition
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您跟随升级指南,您可以看到Newtonsoft不再是Newtonsoft是默认的JSON Serializer。您上面指出的方法被重命名为
configurenewtonsoftjsonserializer
,并且仅在单独的newtonsoft汇编中。如果要配置system.text.json包含默认值,则可以使用以下方式配置这些选项:
If you follow the upgrade guide, you can see that Newtonsoft is no longer the default JSON serializer. The method you pointed out above was renamed to
ConfigureNewtonsoftJsonSerializer
and is only in the separate Newtonsoft assembly.If you want to configure System.Text.Json to include default values, you can configure those options using: