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

How to implement JSONB queries and updates by using LINQ statements? #652

Closed
maikebing opened this issue Sep 23, 2018 · 3 comments
Closed

Comments

@maikebing
Copy link

I'm sorry, I can't stand LINQ and SQL appear simultaneously!
So, how to implement the following SQL statement using LINQ。

update   "DeviceTwins"  set "Reported" ="Reported" || '{    "status": "1"}'
where "ThingsID"='55afda72-fd93-4077-9012-189c23315ec3' and  "Properties" @> '{ "switch": "dzs9l.PV"  }'::jsonb
@roji
Copy link
Member

roji commented Sep 23, 2018

You can't.

First, EF Core doesn't support set updates yet (see dotnet/efcore#795). Second, Npgsql doesn't support mapping LINQ to PostgreSQL-specific JSON syntax (such as @>), see #334.

To do the more complex stuff it's OK to occasionally drop down to SQL...

@roji roji closed this as completed Sep 23, 2018
@pravin13khade
Copy link

@roji - Are we able to able to update the Jsonb column using Linq now? This issue seems old and looking for the latest information if any.

@roji
Copy link
Member

roji commented May 2, 2023

No, not yet.

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

No branches or pull requests

3 participants