Skip to main content

All Questions

0 votes
1 answer
26 views

Confused about NpgSql connection pooling vs AddDbContextPool

I'm trying to implement database pooling in my .net core application that's connecting to PostgreSql db. While reading documentation on NpgSql, It states that pooling is avaible in the this library (...
Morshed Daud's user avatar
0 votes
0 answers
56 views

Entity Framework: could not create socket for "db_connection": listen unix /tmp/cloudsql-proxy-tmp/db_connection/.s.PGSQL.5432: bind: invalid argument

I'm using Google Cloud Run to host a .Net Core 8 application using the Google Cloud Functions Framework. THe entity framework version is 8.0.7. The PostgreSQL database is hosted on Google Cloud SQL. ...
Frédéric Fect's user avatar
0 votes
1 answer
53 views

System.InvalidCastException: Can't cast database type timestamp without time zone to DateOnly

I get this error message when using EF Core to query data: System.InvalidCastException: Can't cast database type timestamp without time zone to DateOnly This is a sample code that causes an error ...
Lan Lin's user avatar
  • 13
-1 votes
0 answers
27 views

Load linked entity via automapper into dictionary

I'm trying to use automapper to pull in a relationship's collection and convert to a dictionary, but I'm struggling with syntax. I have these two entities: class Station { public int Id { get; set; ...
Gargoyle's user avatar
  • 10k
2 votes
0 answers
83 views

Complex select from DB with EF Core without materializing the query

It seems that I need some help from EF guru. So, I have Postgres DB with EF Core in my project. There is a table RequestDbModel which might contain many rows with the same Id and different ts. I need ...
wdtv's user avatar
  • 33
0 votes
0 answers
65 views

Cannot translate EF Core linq query (change SRID of point)

In the code below, I was trying to get geographic points from the database and filter them based on the distance to the user. var pointQueryable = DbContext.Points.OrderBy(x => x.Title)....
Showechy's user avatar
0 votes
0 answers
29 views

Use inheritance in definitions for json column

I have a column definition that works ok for persisting and querying typed json data Entities public class TimeLineDefinition() { public DateTime StartDateUtc { get; init; } } public class ...
Mathias F's user avatar
  • 15.7k
0 votes
1 answer
47 views

EF Core one-to-one relation returns one-to-many relation

I have 2 classes in C#. The problem is EF Core maps relation of one-to-one to one-to-many to the Postgresql database. public class User { public string Id { get; set; } public Subscription ...
Achraf's user avatar
  • 3
0 votes
0 answers
111 views

ICollection cannot be used for parameter of type IList of method PopulateList

I have modified my EF core entities, to swap out all Lists for ICollections, to adhere to my new code linter rules. So why can't I do this anymore: var allVgnItms1 = context.VgnItms.ToList(); without ...
BeniaminoBaggins's user avatar
0 votes
0 answers
37 views

Prevent Entity Framework Core migrations to generate scripts using syntax like $EF$

I'm using Entity Framework Core v6.0.12 and its migrations to generate SQL scripts using: dotnet ef migrations script --idempotent PreviousMigration CurrentMigration --output Scripts/CurrentMigration....
kord's user avatar
  • 1,009
1 vote
1 answer
56 views

How to make a migration to an existing Postgresql database?

I'm using .NET 8, Visual Studio 2022, Clean Architecture, DDD, EF Core, postgresql. I have these 4 layers: Infrastructure, Application, Domain, Presentation I have defined my entities in the domain ...
Nicolai Nygaard's user avatar
0 votes
1 answer
68 views

Is there a way to set IP address as primary key with EF Core (Npgsql)

Entity: public class IPAddressInformation { public IPAddress Address { get; set; } // ... } Configuration: public void Configure(EntityTypeBuilder<IPAddressInformation> builder) { ...
Parsa99's user avatar
  • 376
0 votes
1 answer
110 views

EF Core saves incorrect data to timestamp with time zone when using HasDefaultValueSql()

I work with EF Core and PostgreSQL. When configuring an entity I use this code: modelBuilder.Entity(entityType.ClrType) .Property("Created") .IsRequired() ...
GXtal's user avatar
  • 5
1 vote
2 answers
79 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 ...
Masoomian's user avatar
  • 752
0 votes
0 answers
44 views

Entity Framework Core with Npgsql: Duplicate key value violates unique constraint "PK_Posts"

I'm encountering an issue while trying to save a new PostEntity to my PostgreSQL database using Entity Framework Core with Npgsql. The error message indicates a violation of the unique constraint on ...
Doberman's user avatar

15 30 50 per page
1
2 3 4 5
42