Skip to content

Swapped Newtonsoft.Json for System.Text.Json#20

Open
jamesburton wants to merge 2 commits into
Innofactor:masterfrom
jamesburton:feature/remove-newtonsoft
Open

Swapped Newtonsoft.Json for System.Text.Json#20
jamesburton wants to merge 2 commits into
Innofactor:masterfrom
jamesburton:feature/remove-newtonsoft

Conversation

@jamesburton

Copy link
Copy Markdown

Modified to use the faster System.Text.Json routines and remove the Newtonsoft dependency.


private static string Json(T instance) {
return JsonConvert.SerializeObject(instance);
return JsonSerializer.Serialize(instance, EfCoreJsonValueConverterConfiguration.DefaultJsonSerializerOptions);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this could make use of JsonHelper.

namespace Innofactor.EfCoreJsonValueConverter;

/// <summary>A static configuration class to expose the serializer settings used for the JSON value converter.</summary>
public static class EfCoreJsonValueConverterConfiguration

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be internal?

var serialized = (string)converter.ConvertToProvider(customer);
Assert.IsFalse(serialized.Contains("Privet"), "Serialization applied custom converter");
var serialized = (string)converter.ConvertToProvider(customer);
//Assert.IsTrue(serialized.Contains("Privet"), "Serialization applied custom converter");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better remove this commented out code

@jukkahyv jukkahyv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think this would be a good change. No one uses Newtonsoft anymore.

@jukkahyv

Copy link
Copy Markdown
Contributor

@AlexEngblom could we get this and the other PR merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants