-
Notifications
You must be signed in to change notification settings - Fork 13
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
Native JSON support for EFCore #1
Comments
I like it a lot.
Impatient/test/Impatient.Tests/QueryTests.cs Lines 4276 to 4301 in b1c10f5
I imagine implementing that will lay most of the needed foundation for other kinds of JSON usage. |
I've updated my question, please have a look! |
I've got a proof-of-concept in the branch Impatient/test/Impatient.Tests/QueryTests.cs Lines 4617 to 4643 in 0cc45a8
While not ridiculously dynamic in the sense of using
|
I've gone ahead and merged what I have so far into master. Short of offering a means of providing a custom Now we only handle the query side of things, not anything else in EF (for now) so it looks like maybe EF Core 2.1 with its |
Thanks for your awesome work! |
Oops! Looks like I forgot that with JSON, array indexing can be a translatable thing. https://aspnetcore.slack.com/archives/C0E1PN874/p1525166978000116 Right now it should be working although it will run on the client side. I’m reopening this until I can get some tests and implementation for translating that to server side in there. |
I’ve got something working for both array indexing (with constant and variable index arguments) as well as other indexing expressions. I’m still trying to decide whether or not to limit the ‘other’ indexing expressions to string keys on dictionary types, and I’m still trying use a little bit of combinatorics to come up with a suitable test suite for the functionality. |
Related:
dotnet/efcore#4021
dotnet/efcore#2282
In my vision, there should be an attribute let's say
SqlJsonAttribute
or whatever, that when we use it on an entity property, a string-based (e.g.nvarchar
) column is created for it in the DB, and aHasConversion
is added to theDbContext
for that property instructing EF to transform its contents into JSON (whether it's a complex object, array or whatever), using the JSON serializer registered with theIDbContextServices
/IDatabaseProviderServices
fail-safing to JSON.NET.A middleware will be injected to the EF runtime that intercepts the queries and rewrites all the parts that concern those jsonized properties into
OPENJSON
SQL queries, so that from the point of view of the layer using EF, no special attention has to paid when querying those properties as far as it concerns LINQ to SQL support.The text was updated successfully, but these errors were encountered: