2,156 questions
0
votes
0
answers
156
views
EF Core mechanisms in .NET Core to handle concurrency issues
I am just starting to learn about concurrent processing in EF Core to make consistent applications and I have some questions, Microsoft documentation says the following:
using var context = new ...
1
vote
2
answers
292
views
How can I modify my EF Core query to include an array conversion
Problem Statement
I am using Entity Framework (EF) Core and PostgreSQL. In my target table, there is a JSONB column that might contain a version number. My goal is to sort the query by this version ...
1
vote
1
answer
633
views
Npgsql: How to setup enum mapping in Npgsql v8?
I'm upgrading Npgsql from 7.0.11 to 8.0.2/8.0.3. There are a couple of types in PostgreSQL declared like this:
CREATE TYPE my_type AS ENUM (...)
In SQL, we try to insert or read these types like this:...
2
votes
1
answer
986
views
ProviderIncompatibleException with Npgsql, Postgresql 16.1 and .NET Framework 4.8
I have a legacy Entity Framework application running on .NET Framework 4.8.
Until recently, it connected well to Postgresql 11. Now we upgraded Postgresql to 16. We also upgraded the packages Npgsql, ...
1
vote
1
answer
116
views
Npgsql uneven load balancing during round-robin
I'm seeing strange load balancing behaviour when using Npgsql. I have one primary and three standby servers. As the primary can change (if it goes down and a standby is promoted), I've included all ...
1
vote
0
answers
92
views
Some PostgreSQL tables are not accessible from application using Npgsql, C#/ASP.NET
Background
I am currently writing the server-side application for an online turn-based in-browser game. I have set up a PostgreSQL database with a variety of tables within the default public schema ...
0
votes
1
answer
95
views
npgsql configure __EFMigrationHistoryTable from appsettings.json
I am currently migrating my .net application to PostgreSQL 15. Thus, I need to move all my tables from the public schema to a custom schema.
My __EFMigrationHistory table, also needs to be moved to ...
0
votes
1
answer
271
views
How to suppress warning about constant primary key? Microsoft.EntityFrameworkCore.Model.Validation[20600]
I have a table defined to have exactly one row, by using a boolean primary key and a unique constraint. The idea behind this was based on this post from ten years ago: One-Row by Brandstetter. This is ...
1
vote
1
answer
76
views
PostgreSQL view column NOT NULL is not persist when reverse engineering using Entity Framework Core [duplicate]
I worked with EF Core and SQL Server using database first approach. It is Ok for me to use dotnet-ef CLI for reverse engineering both tables and views. It preserves nullability of select columns from ...
0
votes
1
answer
631
views
Can not apply migration "column cannot be cast automatically to type bigint"
I am running a service locally with existing migrations. When applying one of the migrations, I get an error 'column cannot be cast automatically to type bigint.' What could be the issue if the ...
0
votes
2
answers
2k
views
Conditionally include and filter related entities in EF Core 8
How can I query the Employees and Holidays collections so that even if no holidays are found matching their specified criteria, the employees matching their criteria are still returned?
Entities:
...
1
vote
0
answers
970
views
How to Pass An Array of Custom Types to PostgreSQL Function in C#
I have the following type definition and function that consumes it:
create type my_type as
(
id bigint,
value character varying(100)
);
create or replace function my_function (
my_array ...
0
votes
1
answer
137
views
PostgreSQL JOIN Query with Aliases using capital letters not working
I'm using C# Npgsql library to make some calls and operations into a PostgreSQL Database (the one from Supabase).
I know that Supabase has it's own SDK, but I can't use it.
So far so good all my ...
0
votes
1
answer
111
views
How to map encrypted DateOnly to text in PostgreS
In an ASP.NET Core 8 Web API, I need to store a C# DateOnly entity property in a PostgreSQL text column after encrypting using Npgsql.EntityFrameworkCore.PostgreSQL (8.0.2) and EntityFrameworkCore....
1
vote
2
answers
507
views
Send a very long query through npgsql.createcommand
I’m trying to send a (very) long query to a PostGreSQL V15 Database using NPGSQL with a code that look like that :
string Connection_string = "Host=--:5432;Username=postgres;Password=--;Database=-...
1
vote
1
answer
695
views
How do I connect excel powerquery to a postgres database
I need to connect powerquery to a postgres database in order to clean and have automated access to the data for excel reports.
I've tried: Get Data - From Database - From PostgreSQL database
This ...
0
votes
1
answer
444
views
Npgsql GetDateTime now returns utc instead of local time?
We have migrated from Npgsql 5 to version 8, and now query from the example below is returning time in UTC, whereas previously it returned local time. The SQL function Now itself returns "...
1
vote
1
answer
470
views
Can I set weights on tsvector fields using Npgsql and Entity Framework Core?
I am in the process of setting up full text search on a PostgresSql table, and I am using Entity Framework Core. I have followed the instructions here to set up the generated tsvector column and ...
0
votes
1
answer
531
views
Migrating nullable json column in EF Core to non-nullable
I am trying to migrate a previously nullable json column to a non-nullable column in EF Core using a PostgreSQL 16 database.
The generated MigrationBuilder fragment looks like this:
migrationBuilder....
0
votes
0
answers
273
views
Npgsql throwing buffering error when writing composite type array parameters
We are using Npgsql to access a Postgres database. We recently upgrade Npgsql from 7.0.4 to 8.0.1 and since then we are experiencing irregular problems when calling stored procedures that take arrays ...
1
vote
2
answers
3k
views
Error "Duplicate key value violates unique constraint" when adding with EF Core & Postgresql
I'm trying to enable my application to be able to use SQL Server or Postgresql. My application is using Npgsql.EntityFrameworkCore.PostgreSQL version 8 and EF Core version 8.01.
When I am using ...
0
votes
1
answer
438
views
System.ArgumentException: Host can't be null while creating db in Docker
I'm trying to create a .Net and Postgresql's docker container, but it throws the error when I started to build:
8.578 System.ArgumentException: Host can't be null
This is how I settled the Dockerfile:
...
1
vote
1
answer
586
views
Is it possible to use Npgsql to connect to PostgreSQL from SSRS?
I know that Npgsql is not and OLEDB connector. But it's an ADO.NET one.
I tried to set it up to make it a new type of Data Source for connection to Postgres (on the same level with ODBC, OLEDB or ...
0
votes
0
answers
92
views
Incomprehensible data received from PostgreSQL
I have this problem reading "character varying" field data through a C# program from a PostgreSQL version 12 database table using npgsql.
This is the code I use:
NpgsqlDataSource ...
2
votes
2
answers
922
views
C# 11 raw string literals with ExecuteSqlRawAsync on PostgreSQL have case sensitive problem
I encountered an issue while attempting to modify my SQL query to address warnings about potential SQL injection. I aimed to parameterize the query and use raw string literals, but I received an error ...