Questions tagged [entity-framework-core]
For questions about Entity Framework Core (EF Core) for .NET Core. Please also add a version-specific [ef-core-xx] tag, when applicable. Note that Entity Framework for .NET Framework is an older, different product that fits the [entity-framework] tag.
entity-framework-core
22,704
questions
0
votes
0
answers
7
views
Unable to query entity after adding Json Column (EF Core 8)
We're extending out some of our database models by leveraging new json features released with entityframework core 7, however after adding the property, we're no longer able to retrieve data without ...
-2
votes
0
answers
32
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
0
answers
20
views
Receiving TaskCanceledException when using passwordless authentication with Azure Functions and Entity Framework with SQL Server
I am using Isolated Azure Functions and SQL Server with Entity Framework. This is configuration I am having inside my Program.cs of corresponding Azure Function App:
var connectionString = ...
1
vote
1
answer
49
views
Complex select from DB with EF Core without materializing the query
It seems that I need some help from EF guru. So, I have Postgres DB with EF Core in my project. There is a table RequestDbModel which might contain many rows with the same Id and different ts. I need ...
0
votes
1
answer
24
views
How can I inline parameters in EFCore?
Then track performance of query you can invoke ToQueryString method. If you have a lot of parameters in query it just add @p1, @p2, etc. What to do if you want inline it?
0
votes
0
answers
23
views
Json parse error while using /login method from WebApiCore Identity provided by [email protected]
While configuring authentication and autorization with web.api endpoints and using:
\packages\microsoft.aspnetcore.identity.entityframeworkcore\8.0.6
\packages\microsoft.entityframeworkcore.sqlserver\...
0
votes
0
answers
27
views
Should I create separate Customer and Staff entities with ASP.NET Core Identity and Entity Framework Core
I'm currently developing a multi-tenant, single database web application using ASP.NET Core and Entity Framework Core.
I have two kinds of users:
Customers
Staff
Customers are not tied up to any ...
0
votes
0
answers
33
views
Can't add migration in ASP.NET 8.0 with using MySQL [closed]
This is the error I get:
The exception 'Option 'sever' not supported.' was thrown while attempting to find 'DbContext' types. For the different patterns supported at design time, see https://go....
0
votes
0
answers
26
views
Seeding data when it has relationship
so i need to create foreach entity its own seed class.
the problem becomes when the is some hierarchy of entities, like one entity has a relation with another, second has relation with third and so on....
0
votes
1
answer
21
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....
0
votes
0
answers
63
views
Cannot translate EF Core linq query (change SRID of point)
In the code below, I was trying to get geographic points from the database and filter them based on the distance to the user.
var pointQueryable = DbContext.Points.OrderBy(x => x.Title)....
0
votes
0
answers
28
views
Use inheritance in definitions for json column
I have a column definition that works ok for persisting and querying typed json data
Entities
public class TimeLineDefinition()
{
public DateTime StartDateUtc { get; init; }
}
public class ...
1
vote
1
answer
28
views
EF Core automatically sets the column length when saving enum strings
I have an entity with two enums and I've set a conversion for these two fields to save the string in the database. But when I generate the migration, EF Core creates one column with nvharchar(max) and ...
-3
votes
1
answer
32
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 ...
0
votes
1
answer
62
views
String interpolation inside a formattable string in C#
I am in the process of replacing Dapper with EF Core in a project. Specifically using the new Database.SqlQuery and Database.ExecuteSql functionality with EF Core. I like how they use ...