23,554 questions
Score of 1
2 answers
80 views
Default value for a navigation to an owned entity
Is having a default non-null value for a navigation property to an owned entity type supported in EF Core? I've seen the docs and issues like #18007 that this shouldn't be done for non-collection ...
Score of 2
2 answers
104 views
Entity Framework Core self referencing many-to-many relationship
I have 2 tables in my database: Product and BundleProduct.
public class Product
{
public Product()
{
BundleProducts = [];
}
public Guid Id { get; set; }
public ...
Score of 2
1 answer
169 views
EFCore.BulkExtensions 10: how to update only selected properties of an Owned entity?
I upgraded from EFCore.BulkExtensions 6.8.1 to EFCore.BulkExtensions.SqlServer 10.0.1.
I have an entity with an owned type:
public class MainEntity
{
public OwnedData OwnedData { get; set; }
}
...
Score of 3
1 answer
138 views
How can I guarantee idempotent processing with EF Core when two application instances handle the same message concurrently?
I have a .NET 8 application running on multiple instances. Each instance consumes messages from the same queue.
The queue provides at-least-once delivery, so the same message can occasionally be ...
Score of 0
0 answers
117 views
How to integrate Wolverine migrations with Entity Framework Core
I want to setup WolverineFx to add its tables (outbox and inbox pattern) to my migrations when calling Add-Migration using Entity Framework Core tools. Unfortunately, for 13 hours straight, I'm ...
Score of 0
1 answer
85 views
Entity Framework Core tools doesn't remember migrations folder when using multiple DB contexts
I have two DB contexts. To place migrations in separate folders, I run:
dotnet-ef migrations add Init420 --context AssetsDevDbContext --output-dir Migrations/AssetsDevDb
It creates files and ...
Best practices
0
votes
6
replies
123
views
Entities A and B. One-to-many relationship. Should I use primitive collections when searching values in B?
Let me explain the title first: Entity A is a complex one (such as person or student), whereas entity B is a "primitive" one (such as string or number).
Here are two examples I can think of:
...
Score of 3
1 answer
160 views
Why is EF Core mapping a SQL Server date column to DateTime instead of DateOnly in a database-first model? [closed]
I have a SQL Server table with a column defined as:
date NULL
The corresponding entity class maps this column to a property with the DateOnly? type. There are no custom converters defined in the ...
Score of 1
2 answers
118 views
How to extend subset of products by ones determined by few product groups?
The subset of products - reduced for categories and product lines assigned to the user - should be extended by products from explicitly named groups.
So far, the following code works:
products = ...
Score of 2
1 answer
213 views
WinUI 3 MSIX app from Microsoft Store fails to create SQLite tables, but works in Debug/local build
I have a WinUI 3 / .NET 8 app packaged as MSIX and published through Microsoft Store.
The app uses EF Core 8 with SQLite. On startup I initialize the database with migrations:
using var db = Services
...
Score of 7
1 answer
243 views
How to map complex property from stored procedure results in Entity Framework Core?
I am trying to map the results of a stored procedure to a keyless entity in Entity Framework Core, but I am getting this exception at runtime:
System.InvalidOperationException: The required column '...
Advice
0
votes
1
replies
52
views
Tag Certain EF Properties to Be Created as Final/Last Columns?
I am planning to add a set of audit columns to all the tables I create as part of a large EF core 10 migration. I initially set this up with an AuditableEntity : IAuditable class that contained the ...
Score of 0
2 answers
129 views
Can't get two DbContexts to work in same ASP.NET Core solution with EF Core / SQL Server
Two DbContext for two separate databases in same infrastructure project (all in the same namespace if that matters). All entities are in same domain project (entities for each database are in their ...
Best practices
0
votes
9
replies
260
views
C# Entity Framework issue when working with SQL Server in blog project
I'm studying C# and currently working on a blog project using SQL Server. I’m having trouble understanding a specific part of my code when things get more complex.
I’ve tried to figure it out on my ...
Tooling
0
votes
4
replies
818
views
Pomelo version compatible with EF Core 10
My employer is making us use ef core 10 and I have problem migrating data because the pomelo nuget package that seem to be out and available is v 9
when will the version that's compatible with ef core ...