All Questions
Tagged with entity-framework-core .net
1,881
questions
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
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 ...
1
vote
2
answers
42
views
Unable to create an object of type 'IdentityDataContext'
I'm encountering an issue while trying to update my database using Entity Framework Core in my .NET project. When I run the command:
dotnet ef database update --context IdentityDataContext
I receive ...
0
votes
0
answers
31
views
Storing tree structures where a node can be in multiple trees
I am trying to find a way to build a model in Entity Framework to represent Courses and Lessons, where each course can have multiple Courses and lessons within it. However i also want to make it so ...
1
vote
0
answers
35
views
Entity Framework Core in memory reading wrong data type
My functional tests use Microsoft.EntityFrameworkCore.InMemory version 7.0.20.
When I run the functional tests for any entity that has a dateonly field, I get an error:
Expression of type 'System....
0
votes
0
answers
56
views
Setting up and Querying Temporal Tables in .Net 7
Using .Net 7 Entity Framework, I have a system of tables that mark as Temporal, so that I can reconstruct the data structure from the past (i.e. when a user makes a change, I should be able to roll ...
0
votes
0
answers
71
views
Entity Framework Core Unidirectional many-to-many not working
I want to use a Unidirectional many-to-many relationship but I can't seem to get it to work.
I use EF Core 8.0.6 and recreated the example (https://learn.microsoft.com/en-us/ef/core/modeling/...
-1
votes
1
answer
65
views
Cannot add multiple same objects to DB, only distinct are saved. .NET EntityFramework
I have a template of exercise with name, description and amount of sets. I want to create multiple objects of Exercise * amount of sets. For example I have template [{ "name" : "Legs&...
0
votes
1
answer
29
views
EF Core 8 ComplexProperty mapping: Unable to cast 'ComplexType' to type 'IReadOnlyEntityType'
I run into following exception when mapping any value object in any aggregate:
---> System.InvalidCastException: Unable to cast object of type 'Microsoft.EntityFrameworkCore.Metadata.Internal....
-3
votes
1
answer
36
views
why don't Show EF Core 6, AppDbContext onModelCreating in modelbuilder.HasDefaultSchema("Schema name"); [closed]
why dont Show EF Core 6, AppDbContext onModelCreating in
modelbuilder.HasDefaultSchema("Schema name");
i tried different methods,
I almost asked the AIs too,
ChatGPT, Bing etc. but somehow ...
1
vote
1
answer
77
views
.Net 8 Entity Framework returns null data when there is data in the table
In the lines below, the first line always returns a count and does it for every table.
The second line returns rows for some tables but null data for others (even ones with data and a count returned). ...
2
votes
2
answers
182
views
What's the best way to update ~500 entities with EF Core? [closed]
Right now I loop through each entity and call ExecuteUpdateAsync then after the loop I call CommitAsync, but I'd like to know if there is a better way for updating ~500 records?
I see this bulk ...
0
votes
1
answer
121
views
Do I need to use a cancellation token when running bulk ExecuteUpdateAsync?
I have the code below where I call a service to fetch data, then save the data in a list (transfers). Then I loop through each transfer to update a specific row in the DB.
QUESTIONS -
Do I need to ...
0
votes
0
answers
63
views
EF Core 8 - how to represent SQL Server query?
I am new to using EF Core and I am having trouble representing a query with it. I have this T-SQL query which I am having trouble representing with EF Core 8.
We are using database-first approach and ...
0
votes
2
answers
85
views
How do I run EF Core ExecuteUpdateAsync and add a new entity as part of that update?
I'm running the code below but getting an exception on YogabandyFee when running it.
var payoutResult = await _dbContext.StripePayouts
.Where(p => p.StripePayoutId == stripePayoutId)
....