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,745
questions
0
votes
0
answers
11
views
EF Core 8: table splitting
I'm trying to use table splitting with EF Core 8 and I'm having some issues with the mappings.
Here's what my types look like:
public class Employee
{
public int Id { get; set; }
public int ...
0
votes
1
answer
26
views
No artifact output from dotnet-ef migrations script in Devops Pipeline
I have a Devops pipeline which used to run under a windows-latest agent. We've recently moved it to ubuntu-latest for a variety of reasons. However since that change, the dotnet-ef tool has not been ...
1
vote
1
answer
19
views
The instance of entity type 'Transaction' cannot be tracked because another instance with the same key value for is already being tracked
I am performing a read operation from the XLS file and doing the insert if the data is not present in the table.
DB Operation:
foreach (var transaction in transactions)
{
if (!_dbContext....
0
votes
1
answer
23
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
29
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 ...
0
votes
2
answers
71
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, ...
1
vote
2
answers
73
views
Transform DateTime field to provided format in where clause
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 drastically over ...
0
votes
1
answer
41
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
43
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
45
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
39
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
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 (...
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;
...