Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
7 replies
118 views

I have a list that is the result of a db query. I need to be able to query another table but filter that query based on the first list. In a perfect world I would join these two tables but they are ...
Wilock's user avatar
  • 51
0 votes
1 answer
114 views

I tried to DataSeed some data, but I got this error: SqlException: The MERGE statement conflicted with the FOREIGN KEY constraint "FK_SubCategories_Categories_CategoryId". 1st I tried to do ...
Newbie's user avatar
  • 11
0 votes
4 answers
281 views

I have the following query generated by EF: SELECT [t].[Id], [t].[ActiveStateLicenseId], [t].[AvailableDate], [t].[City], [t].[CreatedBy], [t].[CreatedOn], [t].[DateOfBirth], [t].[Email], ...
TheIronCheek's user avatar
  • 1,267
0 votes
1 answer
126 views

Let's have 3 entities with the same base class for ID's: public class EntityBase { public int Id { get; set; } } public class Company : EntityBase { public string Brand { get; set; } public ...
Pavel Foltyn's user avatar
1 vote
2 answers
98 views

I keep getting error .DrpString.Contains(dienstregelpunt)' could not be translated. I have a string[] dienstregelpunten array and a database field containng dienstregelpunten as a csv field. See ...
Joost V.'s user avatar
2 votes
1 answer
137 views

I have a list of records, by multiple UserID's. TableID UserID Status ------------------------ 1 3 3 2 4 3 3 3 4 4 4 3 5 5 4 6 ...
Sherry8212's user avatar
Tooling
0 votes
4 replies
119 views

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. ...
alex_pythooon's user avatar
4 votes
2 answers
724 views

I tried adding a migration via dotnet ef migrations add InitialCreate but got the following error C:\Users\tmsta\OneDrive\source\repos\Server Default\TrevorsTempMonitorApp\TrevorsTempMonitorApp.csproj ...
Trevor Stauffer's user avatar
Advice
0 votes
2 replies
53 views

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;...
Arnaud VDR's user avatar
1 vote
4 answers
228 views

I am looking for a way to use the .Include clause of Entity Framework while avoiding duplicate code. I have a lot of classes, and every class has a method which looks something like this: query = (...
Karsten Heimer's user avatar
2 votes
1 answer
104 views

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 ...
RotundChinchilla's user avatar
1 vote
1 answer
122 views

I am trying to use the InsertFromQuery() to add data to a SQL table: await cx.Users .Where(x => x.Country == "Romania") .InsertFromQueryAsync("Mailbox", mb => ...
Ginto's user avatar
  • 41
0 votes
1 answer
168 views

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], [...
TheIronCheek's user avatar
  • 1,267
1 vote
0 answers
82 views

After updating our Dotnet API from dotnet 6 to 8 the connection-attemps on AWS RDS increased significantly (see attached picture). The API is running in a docker-container. We use a MYSQL RDS instance ...
jonny's user avatar
  • 34
1 vote
1 answer
96 views

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 ...
FluidMechanics Potential Flows's user avatar
6 votes
1 answer
274 views

We are planning to use a Gitflow workflow and a shared test database. We currently use EF 6.5.1 and have automatic migrations disabled. Problem: if a developer runs Update-Database (or dotnet ef ...
EMN's user avatar
  • 163
1 vote
2 answers
151 views

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 ...
d_88_l's user avatar
  • 67
2 votes
0 answers
576 views

I am creating a brand new project to prototype an ASP.NET Core 9 Web API backend with PostgreSQL using the latest Entity Framework Core 9 and Npsgsql 9. Everything was going well until I hit a table ...
Trant's user avatar
  • 3,671
0 votes
0 answers
75 views

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 ...
loloskc's user avatar
0 votes
1 answer
107 views

I have a TaskFlowTemplate, pretty standard but a bit complex. Our users will have the ability to work locally in memory without need to save after every changes. My primary key is int Id. public class ...
Tobias Gustafsson's user avatar
0 votes
0 answers
71 views

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 ...
Matt Larson's user avatar
0 votes
1 answer
123 views

I'm using Hilo with a custom sequence name. When creating migrations, EF Core always creates a migration to drop the sequence with the normal name. Since EF Core 9.0, this produces a runtime exception ...
Merijn's user avatar
  • 751
1 vote
0 answers
280 views

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....
sevzas's user avatar
  • 841
2 votes
2 answers
150 views

I have situation like this: I have two Blazor components, both using dbContext and I get popular error A second operation was started on this context instance before a previous operation completed. ...
Vlado Pandžić's user avatar
3 votes
1 answer
135 views

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 ...
Red Puffle's user avatar
0 votes
1 answer
147 views

I want to implement "soft delete" in my application, meaning that instead of physically removing records from the database, I set an IsDeleted flag to true. My expectation is to intercept ...
Tetik's user avatar
  • 1
-2 votes
1 answer
120 views

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 ...
Артур Дементьев's user avatar
1 vote
1 answer
86 views

I have a web application: var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); builder.Services.AddDbContext<...
JustAnotherCoder894's user avatar
1 vote
1 answer
114 views

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 ...
Kafkaa's user avatar
  • 89
-2 votes
1 answer
117 views

I have a C# (C# 7.5) application that is using EF6. I have a table that contains two foreign keys. Both are one:one relationships and both are required. When I load a record from the database, the ...
AndyW's user avatar
  • 527
0 votes
1 answer
416 views

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....
urtopcuoglu's user avatar
0 votes
0 answers
222 views

Im using EF Core in a .NET 9.0 Web API project, and I was trying to implement automatic migrations on API startup. The current project makes use of Docker containers (Configured using a Docker compose ...
thezuliano's user avatar
0 votes
1 answer
131 views

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 ...
dafie's user avatar
  • 1,189
1 vote
1 answer
140 views

I'm working on a project that uses the legacy .NET Framework 4.x. I'm using LINQ here, but it's not behaving as I expected, and I'm not sure what mistakes I've made. I have the following MySQL table: ...
Tommas Lees's user avatar
1 vote
1 answer
93 views

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 ...
redoc01's user avatar
  • 2,557
1 vote
3 answers
157 views

This post is translated Ko to Eng. I understood that using .Include() in Entity Framework triggers eager loading, and that when I include multiple entities, they would all be joined in the SQL query — ...
RKO's user avatar
  • 13
1 vote
1 answer
92 views

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 ...
C Howell's user avatar
0 votes
1 answer
183 views

I'm encountering an issue when executing transactions on system-versioned tables (SQL Azure) in my ASPNET Core + Entity Framework app. In my database, there are two system-versioned tables: dbo....
ilMattion's user avatar
  • 2,019
0 votes
2 answers
117 views

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....
Matt's user avatar
  • 7,015
2 votes
1 answer
53 views

I am attempting to create a method that filters data based on what the user types into my search bar. What to want to do is filter based on the name of a suspect. "Suspects" being a child ...
kylecol's user avatar
  • 55
1 vote
1 answer
230 views

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 ...
NickL's user avatar
  • 1,980
0 votes
0 answers
83 views

I am working on a Blazor Web App using SQL as my database. My initial database migration works fine. However, when I make a change to one of the model classes, even a simple change, and try and add a ...
physics90's user avatar
  • 963
1 vote
0 answers
82 views

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] ...
Radek Strugalski's user avatar
0 votes
1 answer
26 views

I'm trying to run the EF Core Northwind tests for our EF Core implementation and the calls to AssertSql (which call AssertBaseline()) fail as below. This is with .NET 8, Xunit 2.9.3, in Rider, on ...
mn_test347's user avatar
0 votes
1 answer
64 views

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 ...
bradd's user avatar
  • 3
0 votes
1 answer
90 views

I have an await _context statement that returns a single value from a table (StatusDesc). This StatusId is unique for each ID. The current code only retrieves the StatusDesc: var status = await ...
socker_dad's user avatar
1 vote
1 answer
143 views

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 ...
SyndRain's user avatar
  • 4,082
0 votes
1 answer
160 views

Currently migrating to using Microsoft.Data.Sqlclient within our app that uses Ef6. We are on Ef 6.5.1 and using the Microsoft.EntityFramework.SqlServer package. When attempting to run a query with ...
cvb's user avatar
  • 791
0 votes
1 answer
62 views

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....
MICHELE TROTTA's user avatar
0 votes
0 answers
209 views

I'm building a .NET Aspire-based application using PostgreSQL with Entity Framework Core. I’m registering my DbContext like this as I am using Aspire.Npgsql.EntityFrameworkCore.PostgreSQL package: ...
geothachankary's user avatar

1
2 3 4 5
1836