AspNetCoreOData
AspNetCoreOData copied to clipboard
Consider exposing Newtonsoft converters
The Microsoft.AspNetCore.OData.NewtonsoftJson package is great for adding Newtonsoft converters for OData classes to MVC
It would also be handy to be able to use these converters outside of an MVC context, for example unit testing.
However, they are all internal so this isn't easily possible.
Please consider if they can be made public. If this isn't possible or desirable (e.g. perhaps they reference internal classes and you don't want to cascade a change to public in lots of classes) then consider a public extension method on SerializerSettings which adds them.
https://github.com/OData/AspNetCoreOData/blob/9225d1eba1601bf1470b7e611cdd595fa479dbfc/src/Microsoft.AspNetCore.OData.NewtonsoftJson/ODataNewtonsoftJsonMvcBuilderExtensions.cs#L83-L94
You could then refactor the above code to use the new extension method to avoid duplication.
I can raise a PR for this if you think it's a valid proposal.
@stevendarby can you please provide me an example on how you accomplish "The Microsoft.AspNetCore.OData.NewtonsoftJson package is great for adding Newtonsoft converters for OData classes to MVC"
We are trying to use a custom converter to convert "System.Net.NetworkInformation.PhysicalAddress" -> string and wea re not able to....
Wrong place to ask this.
But I would like to know if maintainers of this repo could triage my year old issue?
@xuzhg
@xuzhg this has never been triaged?
@stevendarby I'm curious to know how exposing these would help with unit testing. Can you elaborate?