Skip to content
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

Mixing Database Functions and Value Conversions #16617

Open
Tracked by #240
ghost opened this issue Jul 16, 2019 · 2 comments
Open
Tracked by #240

Mixing Database Functions and Value Conversions #16617

ghost opened this issue Jul 16, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 16, 2019

Is there a way to use database functions and value conversions together in the way described in this question https://stackoverflow.com/questions/56261258/mixing-ef-core-convensions-and-dbfunction-for-a-jobject-property or is this feature is planned for a future release ?

@ajcvickers
Copy link
Member

Triage: putting this on the backlog as a more specific case of #10434

@smitpatel
Copy link
Member

For the original question posted in stackoverflow
Since 3.1, you can specify the store type for the parameter as follows

modelBuilder.HasDbFunction( typeof(MyDbContext).GetMethod(nameof(JsonValue)))
                      .HasName("JSON_VALUE")
                      .HasParameter("column")
                      .HasStoreType("nvarchar(max)")

This will configure the store type for the parameter. It will pass the validation and also treat the value being used there as of type nvarchar on server.

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

No branches or pull requests

2 participants