91,848 questions
2 votes
1 answer
106 views
Entity Framework/Linq Get Last Record From List With Condition
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 ...
Tooling
0 votes
4 replies
71 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. ...
0 votes
0 answers
87 views
error MSB4057: The target "ResolvePackageAssets" does not exist in the project
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 ...
Advice
0 votes
3 replies
46 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;...
1 vote
4 answers
210 views
How to use .Include() in Entity Framework across classes without repetition [closed]
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 = (...
2 votes
1 answer
76 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 ...
1 vote
1 answer
108 views
How would I use N.EntityFramework.Extensions to insert into another table
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 => ...
0 votes
1 answer
151 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
0 answers
66 views
Mysql ConnectionAttempts increased on AWS RDS after dotnet 6 update to 8
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 ...
1 vote
1 answer
88 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 ...
6 votes
0 answers
142 views
How to manage Entity Framework migrations and databases when using Git version control?
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 ...
1 vote
2 answers
135 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 ...
1 vote
0 answers
207 views
Enum mapping hell PostgreSQL => EF Core 9
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 ...
0 votes
0 answers
45 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
1 answer
95 views
EF Core, Work locally, save/update entire tree of data
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 ...