91,850 questions
Tooling
0
votes
4
replies
55
views
Is there a Database First approach in Java like Entity Framework in C#?
I’m used to working with a Database First approach in C#. I design my database schema (often with MySQL Workbench) and do a forward engineering, then generate my C# models using Entity Framework’s. ...
Advice
0
votes
3
replies
44
views
How to set the value in the basic many-to-many relationship example of EF?
Here's a basic example from the official .NET documentation for a many-to-many relationship using EF and .NET:
public class Post
{
public int Id { get; set; }
public List<Tag> Tags { get;...
2
votes
1
answer
75
views
How can I instantiate and populate nested/complex objects with Select() in Entity Framework 6?
I am attempting to backport some code written with Entity Framework Core to Entity Framework 6. I've encountered an issue where EF Core can successfully instantiate a complex DTO (i.e. an object with ...
0
votes
1
answer
149
views
SQL query produced by Entity Framework very slow
I have the following query being generated by EF:
DECLARE @__term_0 VARCHAR(7) = 'woodrow'
DECLARE @__p_1 INT = 0
DECLARE @__p_2 INT = 15
SELECT [t].[Id], [t].[City], [t].[Contact], [t].[CreatedBy], [...
1
vote
1
answer
80
views
EF Core populating its navigation although it shouldn't
I am reading the book C#12 In a Nutshell. The author says:
Loading navigation properties
When EF Core populates an entity, it
does not (by default) populate its navigation properties:
using var ...
1
vote
2
answers
129
views
C# Entity Framework use value from joined object and only return main object
I am trying to populate a object with additional data from another object with Entity Framework from our data tables.
public partial class Maintable
{
public int Id { get; set; }
public int ...
0
votes
0
answers
44
views
I can't create my custom filter in HotChocolate 13.5.0, where can I view detailed documentation or code examples?
I'm trying to create my own filter for a specific type of data in hotchocolate.
I created a class from FilterInputType<MyType> and specified an additional field for filtering in it. For this ...
0
votes
0
answers
71
views
Entity type cannot be tracked error - Entity Framework
I have been messing with this for days now and I'm at a loss. I keep getting
The instance of entity type 'LineItemHeader' cannot be tracked because another instance with the key value '{id:1}' is ...
1
vote
0
answers
148
views
Orphaned pg_temp_# and pg_toast_temp_# schemas in postgresql 17.5 slow down ORM model update
I am running PG 17.5 Windows using the EDB community distribution. I am using Entity Framework ORM with Devart's dotConnect for PostgreSQL. The issue I am about to describe did not occur under PG 13....
3
votes
1
answer
84
views
How to add custom pluralization of table names when using "dotnet ef dbcontext scaffold" command
I am running the following command to scaffold C# models of an existing database:
dotnet ef dbcontext scaffold "<conn string>" Microsoft.EntityFrameworkCore.SqlServer
I would like to ...
-2
votes
1
answer
84
views
Adding a file path to the local storage in the ViewModel MVVM NET MAUI [closed]
enter image description here
My task is to get a photo from the stream and then save it to local storage and pass the path to this photo to the ViewModel, and then save the path in the database. I put ...
1
vote
1
answer
101
views
How to Track Full Update History of TPT Entities in EF Core with MySQL [duplicate]
I'm designing a .NET Core application using EF Core with a MySQL database, following a Table-per-Type (TPT) inheritance strategy.
I have a base Report class with several derived types such as ...
0
votes
1
answer
208
views
NETSDK1064: Microsoft.EntityFrameworkCore.Analyzers 9.0.6 not found after NuGet restore (possibly due to long path issue)
I'm trying to build a .NET 9 project using Visual Studio, and I keep getting the following error:
Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1064: The Microsoft....
0
votes
1
answer
130
views
Check if rows exists, and add if not
This is my table:
user_id
last_activity_time
1
2025-06-20 11:00:01
2
2025-06-20 11:00:02
3
2025-06-20 11:00:03
4
2025-06-20 11:00:04
Let's say, my input parameter if a user id list: [ 3, 4, 5 ]. I ...
1
vote
1
answer
88
views
LINQ query not grouping and when returning, missing data
I have grouped orders from the orders table so an order can have one or more purchases of a product with in an order. The problem is that when I purchase a single product that order with one product ...
1
vote
1
answer
63
views
"inheritance" between mappings using Expression<Func<...>> for Entity Framework queries
A rather complicated object mapping I've inherited uses static Expression<Func<...>> in the .Select call (from my research these seem to be called "Expression Trees", but for ...
0
votes
2
answers
83
views
How can I convert an EntityQueryable to an IIncludableQueryable?
How can I convert an EntityQueryable to an IIncludableQueryable? I get this error...
Object of type
'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable1[Extenso.TestLib.Data.Entities....
1
vote
1
answer
153
views
Are there any downsides to using AsAsyncEnumerable over an Entity Framework query?
My use case is that I want to retrieve a large number of records from the database and write them to a file stream, e.g. a .csv file.
To reduce memory pressure I thought I'd use it as an ...
1
vote
0
answers
76
views
How to include related entities in many to one relation when no FK defined in the DB schema
I have the following 2 tables defined in the DB (follows) with fixed schema, meaning I am not allowed to change it. Some details were omitted for readability:
CREATE TABLE [periods]
(
[id] [int] ...
0
votes
1
answer
63
views
How to get a drop down list of imported values, and use it to filter a foreach list of values below it
I have a page that lists a bunch of doctors with their specialties, and a drop down list of specialties above it. When you initially open the page, it shows all doctors below the drop down list. I ...
0
votes
0
answers
102
views
Same projection mappping in IQueryable.Select but with Varied Child Collection filters in EF6
I have methods used in IQueryable.Select(...) that shares the same logic of mapping an Entity class to a DTO class, but filter the navigation properties in the projection differently. The problem is ...
0
votes
1
answer
61
views
Entity Framework and database
I'm working on an EF project. This is my entity:
namespace AnagraficaEF.DA
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System....
0
votes
1
answer
77
views
Explicitly Loading filtered navigation property via Load() not working
I have a query that I want to return an entity with a filtered collection navigation property. According to the EF6 document I should be able to load it via explicit loading. However, after the ...
0
votes
2
answers
143
views
How to make LINQ query faster
Running NbLinksExpirationStatus takes about 12 seconds to execute, which is not fast enough for what i am trying to achieve. Could it be Contains() problem and is there any way i can make it execute ...
1
vote
1
answer
235
views
Workaround in Entity Framework 6 for keyless tables
We have a .NET Framework 4.8 application that uses Entity Framework 6.
Now we are having a problem that we need to add some tables that don't guarantee any uniqueness (no primary key and rows can ...