You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to query by using postgis extension. I can execute the function in postgresql database. But i fail in .net core project. This is used in an ASP.NET Core 8 application.
Referenced packages:
Program.cs
add extension in DbContext
modelBuilder.HasPostgresExtension("postgis");
entity
generate geometry object named as region where is used in method in repository
query in repository
var query = GetQueryable()
.Include(e => e.Locations)
.ThenInclude(e => e.PowerUnits)
.WhereIf(region != null, e => e.PowerUnits.Any(p => region!.Contains(p.Coordinates)));
error:
Is there something wrong in my code? Could you kindly please help me?
The text was updated successfully, but these errors were encountered:
Can you please submit a minimal, runnable project or code sample that shows the problem happening? It's difficult to reconstruct a problem from a bunch of snippets and screenshots as above.
call repository to query
even i use the native sql to query, but it doesn't work
DbContext
this extension is used in a new schema under the database named as deployment
Related Entity
Program.cs
This is all the codes related with this issue.
Besides, I have already executed below sql in database.
the last sql can be executed in database and cannot be executed through codes. same error like "ST_Point doesn't exist"
I probably find the reason. However, I don't know how to solve it with EF core. I need to call the function under the schema "deployment". But the generated SQL doesn't include the "deployment" schema! Am I right? If so, how to specify the schema when I use the contains or within method.
I already add default schema in DbContext like below:
@flyinseal as a general rule, please don't post screenshots of code when reporting issues. As the maintainer, there's very little I can do with screenshots - I can't copy and paste your code, and it's frequently also very hard to actually read it (because the text is very small). Please go through the effort of actually producing a minimal, runnable code sample - like a simple console program, that, when executed, produces the problem.
I'm asking for this since I'm currently unable to reproduce your problem. And in 90% of cases, when users actually make the effort of creating a minimal repro, they run into some issue in their own code which caused the problem.
Hi,
I want to query by using postgis extension. I can execute the function in postgresql database. But i fail in .net core project. This is used in an ASP.NET Core 8 application.
Referenced packages:
Program.cs
add extension in DbContext
modelBuilder.HasPostgresExtension("postgis");
entity
generate geometry object named as region where is used in method in repository
query in repository
var query = GetQueryable()
.Include(e => e.Locations)
.ThenInclude(e => e.PowerUnits)
.WhereIf(region != null, e => e.PowerUnits.Any(p => region!.Contains(p.Coordinates)));
error:
Is there something wrong in my code? Could you kindly please help me?
The text was updated successfully, but these errors were encountered: