Questions tagged [entity-framework-core]
For questions about Entity Framework Core (EF Core) for .NET Core. Please also add a version-specific [ef-core-xx] tag, when applicable. Note that Entity Framework for .NET Framework is an older, different product that fits the [entity-framework] tag.
entity-framework-core
22,744
questions
-1
votes
1
answer
21
views
EF Core saving child object without foreign key
I'm working on an application that has one-to-many Companies containing one-to-many Users and integrations with various providers/vendors (examples would be FedEx, UPS, etc) APIs that need to have ...
0
votes
1
answer
12
views
How to Reference a User Entity from Another Microservice in ASP.NET Core?
In my microservices architecture using ASP.NET Core, I have two distinct microservices: Identity.API for user management and PersonalAccount.API for handling personal account-related functionalities. ...
1
vote
1
answer
15
views
.NET EF Core : how to correctly insert and update a model in a many to many relationship with a join table with a payload?
I am writing a .NET CRUD application with layered architecture with EF Core for ORM. I have two models (Players and Teams) stored in the database with a join table between them (Player in Team).
The ...
-1
votes
2
answers
58
views
How do I create an interface for a conditional one-to-many relation?
I am creating an inventory app for electronic components. There is a package for each component which will change if their assemble technology is on SMD or DIP. Each SMD and DIP has its own options, ...
0
votes
1
answer
45
views
C# Entity Framework Core (8.0.6) transform DateTime field to provided format in where clause
currently I'm trying to integrate a search function in my datatable in Asp.Net Core. I load the content dynamically with a query to my MSSQL server. As the database table content will increase ...
0
votes
1
answer
39
views
EF Core 8 dbcontext not loading new data when another app is changing data
I have a Blazor app that accesses data using EF Core. When a separate app edits state on the data, my Blazor app is not getting the data correctly when I reload it.
It fails to load when I try to get ...
0
votes
0
answers
41
views
EF user-defined function mapping: "Ensure the parameter can be mapped by the current provider"
I have a custom type UniversityId (value type):
namespace TestEntityFramework;
public sealed class UniversityId(string value)
{
public string Value { get; } = value;
public override string ...
1
vote
0
answers
41
views
JsonApiDotNetCore and filtering using a udf
I am using JsonApiDotNetCore, .NET Core, and EF Core on SQL Server and creating a REST project implementing the Json API standard.
I have plenty of resources (models) but one of them has some fields ...
2
votes
1
answer
38
views
Entity property is set prior to SaveChangesAsync then sometimes is saved to the database as null, and changed to null in the entity
I have an intermittent problem. I have a C# API project that reads an entity from the database, updates its properties, then calls DbContext.SaveChangesAsync. The entity has a nullable int ...
-3
votes
0
answers
60
views
Why is my code not returning any records? Even though there are rows found. (Entity Framework Core)
using Binus.WS.Pattern.Entities;
using Microsoft.EntityFrameworkCore.Metadata;
using SSG5.C1.BSQWebAPI.Model;
using System;
using System.Collections.Generic;
using System.Globalization;
using System....
0
votes
1
answer
23
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 (...
0
votes
1
answer
53
views
Many-to-many relationship update in EF Core
In my two classes I created a many-to-many relationship:
public class Author
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[DisplayName(&...
-1
votes
1
answer
56
views
Equals method never called by LINQ expression [duplicate]
My data class:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using static iText.StyledXmlParser.Jsoup.Select.Evaluator;
...
0
votes
0
answers
54
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. ...
0
votes
1
answer
52
views
Issue with LINQ Query in Async Method: 'The LINQ expression could not be translated'
I have an asynchronous method in C# that retrieves a list of users with various nested includes and filters. The method works fine when I don't pass the arbsResponse parameter, but I encounter an ...