-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom JsonSerializerOptions in EFCore.MySql.Json.Microsoft #1827
base: main
Are you sure you want to change the base?
Changes from all commits
ad72a52
b6507cb
e511295
982c46a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) Pomelo Foundation. All rights reserved. | ||
// Licensed under the MIT. See LICENSE in the project root for license information. | ||
|
||
using System.Text.Json; | ||
|
||
namespace Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Infrastructure; | ||
|
||
public interface IMysqlJsonOptions | ||
{ | ||
JsonSerializerOptions JsonSerializerOptions { get; } | ||
} | ||
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not convinced that this is the right approach. I think users should have the ability to set They should be able to set a default on the model itself and then also concrete options on (JSON) properties of entities (that override the default options). They also need to be supplied in a JSON provider specific fashion (since we support Microsoft and Newtonsoft JSON implementations). So this requires JSON provider specific extension methods. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Text.Json; | ||
|
||
namespace Pomelo.EntityFrameworkCore.MySql.Json.Microsoft.Infrastructure.Internal; | ||
|
||
public sealed class DefaultMysqlJsonOptions : IMysqlJsonOptions | ||
{ | ||
public JsonSerializerOptions JsonSerializerOptions { get; init; } = new(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a casing issue; shouldn't it be
IMySqlJsonOptions
for consistency?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change it