All Questions
Tagged with postgresql c#
2,467 questions
0
votes
0
answers
53
views
Error registering user: "Duplicate key value violates unique constraint 'PK_Users'"
I am developing a web application on ASP.NET Core using EF Core and PostgreSQL. When making a POST request to https://localhost:7197/api/Auth/register, I sometimes get an error:
Microsoft....
1
vote
0
answers
52
views
EF Core doesn't seem to use NetTopologySuite Point's SRID
I was playing with Postgis extension (not very familiar with it) and was trying to match some coordinates within a route.
The issue is basically the title.
The code:
var spatialReference = 4326;
var ...
-1
votes
0
answers
40
views
Postgres error establishing an SSH connection to database
I'm using the following code to establish a connection to a Postgres database:
MemoryStream keyStream = new MemoryStream(System.IO.File.ReadAllBytes("C:\\Users\\NelsonSoares\\Documents\\Trino\\...
0
votes
0
answers
69
views
Effective aggregation query using EF Core and PostgreSQL
I need to aggregate data using EF Core.
I have the following class:
public class Statistics
{
public long Orders { get; init; }
public decimal Revenue { get; init; }
public long Views { ...
0
votes
0
answers
39
views
PostgreSQL & EF Core 8 Case-Insensitive Contains() Search Issue (Turkish Character Support)
Problem: I'm using PostgreSQL 15 and Entity Framework Core 8.0.3, and I'm facing a case-insensitive search issue with Turkish characters.
Data in the database:
ID
Name
1
MILK THISTLE
2
CLEANSING MILK
...
0
votes
1
answer
89
views
How to get single row of values from database
Reading multiple values from a Postgres database using npgsql and EF Core in an ASP.NET Core MVC view:
var tulem = await ctx.Database
.SqlQuery<(string Klient, int Krediit, int ...
2
votes
1
answer
82
views
Performance issue with Entity Framework query - even with filters, the request takes too long to complete
[HttpGet("{id}/client-history-sw01-module")]
[Authorize(AuthenticationSchemes = "AdminSchema")]
public async Task<ActionResult<object>> GetClientHistoriesSw01Module(
...
0
votes
1
answer
111
views
How to perform Dynamic SQL Query Generation in Dapper?
Question:
How can I dynamically generate SQL INSERT and UPDATE queries in a generic repository using Dapper? Currently, I'm hardcoding the property names in the SQL queries, but I want to make this ...
0
votes
0
answers
62
views
C# PostgreSQL enum conversion [duplicate]
I have a PostgreSQL database with a bunch of user defined types, for example I have the following instructions:
CREATE TYPE joint_type AS ENUM ('Type1', 'Type2');
CREATE TABLE welding(
id SERIAL ...
1
vote
0
answers
63
views
"42883: procedure usp_delete_announcements(integer) does not exist" while calling stored procedure with out paremeters from .NET Core
I am trying to call a PostgreSQL stored procedure with OUT parameters from my .NET Core 3.1 API to delete a record based on an ID. However, when I attempt to execute the stored procedure with OUT ...
4
votes
1
answer
196
views
Polymorphism in Entity Framework Core 9 with PostgreSQL and jsonb column
I am currently working on a database table, that shall contain some base properties of the data and one property that is a jsonb column in the database that can contain different objects that are ...
0
votes
0
answers
45
views
Multi tenancy support for Single database shared schema
We are using a single database with a shared schema multi-tenancy model, as it is the most practical way to support a large number of tenants.
Is there a recommended pattern or approach in Npgsql to ...
0
votes
0
answers
71
views
Database tool in Performance Profiler not working when program is pointed to PostgreSQL
My program in C# using Entity Framework Core I can point to a PostgreSQL or SQLite database. When pointed to PostgreSQL the Database tool of Performance Analyzer does not work. There only appear ...
0
votes
1
answer
110
views
The LINQ expression could not be translated when using MaxBy
Entities:
public class User
{
public long Id { get; }
public ICollection<File> Files { get; }
}
public class File
{
public long Id { get; }
public DateTime CreatedAt { get; }
public ...
1
vote
1
answer
172
views
LINQ way to unnest arrays
I have a table in a Postgres DB with a string[] column for tags. I now want to get all distinct tags. My first approach was a .SelectMany(d => d.Tags).Distinct(), which leads to an error The LINQ ...