25 questions
1
vote
2
answers
237
views
Why let with where clause can't translate to SQL?
I have a code snippet that uses let with a where clause.
private List<string> Example2()
{
var query1 =
from c in _context.Customers
let custPurchases = _context.Purchases....
1
vote
1
answer
79
views
HotChocolate [UseSorting] / [UseFiltering] LinQ conflict with ValueObject
Using HotChocolate v15.1.8 with EF v9.0.7 and Mapster v7.4.0, I encounter a bug with [UseSorting] / [UseFiltering] LinQ conversions which appear invalid when applied to DDD ValueObject or EF complex ...
2
votes
2
answers
65
views
Join two tables and get only one record of the second table for each record of the first table
I have two model classes; the first contains all the fields of the table which are not multilanguage fields.
public partial class Brand
{
public long BrandID { get; set; }
public string Name { ...
3
votes
3
answers
114
views
EF Core: child's composite foreign key not updated with parent's trigger-generated ID in single SaveChanges
How to use EF Core to manage a composite foreign key referencing a parent record whose ID is generated by a database trigger after insertion?
The parent entity's ID is not available during initial ...
-1
votes
1
answer
48
views
I cannot do a scaffold with a few tables with user secrets in my API project in .NET 9
I'm new to ASP.NET Core 9 Web API, I'm trying to do a scaffold with a existing database and using user-secrets follow the Microsoft documentation.
I created my user secret file and my keys something ...
0
votes
2
answers
98
views
DataAnnotations being ignored in Blazor server-side .NET 9 page
I have a new .NET 9 Razor page Blazor server-side project.
I used EF Core Power Tools to import my database schema and generate the DbContext and model classes.
I created a MetaData class for one of ...
1
vote
1
answer
434
views
TenantInfo returns null in finbuckle.multitenant with .NET Core
I am trying to configure multiple tenants in ASP.NET Core 8 MVC project.
I am using
Finbuckle.MultiTenant.AspNetCore - v9.0.0
Finbuckle.MultiTenant.EntityFrameworkCore - v9.0.0
Microsoft....
0
votes
1
answer
54
views
EFCore build a where clause as a string
In Entity framework I could build a where clause as a string.
For example;
var whereClause = "ID > 0 and !Inactive";
pList.AddRange(MyData.Set<T>().Where(whereClause).ReduceCasts()....
0
votes
1
answer
197
views
EF Core FirstOrDefault returns null even if entity exists
I am facing an issue where I cant fetch an entity when using .FirstOrDefaultAsync() with a GUID as the primary key.
If I fetch all entries first and then run .FirstOrDefault it works.
The entity in ...
-1
votes
2
answers
562
views
EF Core 9 : the database operation was expected to affect 1 row(s), but actually affected 0 row(s)
I am using DDD architecture and the following code changes the aggregate root (basically adds a comment which is an entity to the aggregate root).
public sealed class AddCommentToPostCommandHandlers : ...
0
votes
1
answer
263
views
EF Core 9 .HasConversion
I am trying to follow DDD in a new project im working on and have run into an issue when it comes to configuring one of my ValueObjects.
I have the following AggregateRoot
public sealed class Event : ...
0
votes
0
answers
43
views
EF Core 9, inserting into a MySQL table with Composite Unique Constraint Best practice? [duplicate]
I'm working with a MySQL table that has a composite unique constraint on two columns (column1 and column2), like this:
CREATE TABLE example_table (
column1 INT,
column2 INT,
column3 ...
4
votes
2
answers
4k
views
Unable to create DbContext due to GetDatabaseLock method missing in Npgsql EF Core 9.x
I'm working on an ASP.NET Core project using Entity Framework Core and Npgsql for PostgreSQL. I'm trying to create a DbContext to manage my database, but I'm encountering the following error when I ...