Skip to main content

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
1 vote
1 answer
42 views

Expression Visitor access property on parameter representing local variable

Trying to write an ExpressionVisitor that would rewrite a query Starting point var contractSubjectKey = new ContractSubjectKey(subjectId, rank); insurance = context.Set<Insurance>() ....
Matus's user avatar
  • 181
0 votes
1 answer
63 views

EF Core SaveChanges fails (v8.01 on .NET 8)

After upgrading from .NET Framework with EF to .NET 8 with EF Core, I am unable to modify my SalesQuotes. I am using table per type strategy. This code fails: var connect = HandyDefaults....
Kirsten's user avatar
  • 17.4k
0 votes
1 answer
24 views

EF Core - Need to reference the many-to-many join table in code-first application

I have a mapping application that will display pins on a map that represent Features at Member addresses (e.g. a Member lives at lat/long 'X' and is associated to Feature 'Y'). Members can be ...
Bob H's user avatar
  • 51
0 votes
0 answers
21 views

Failing migration after update to EF Core 8: The object has been removed from the model

After upgrading our application from .NET 6 to .NET 8, we are able to access the application and interact with the DbContext. However when interacting with DbContext through the dotnet-ef tool, for ...
Superman.Lopez's user avatar
0 votes
2 answers
64 views

Moving database contexts to library project results in "FileNotFound" exception

I have a .NET Core 7 solution EIT which had only 1 project: EIT. This project uses Entity Framework Core to model and access the database. This worked fine. Now I want to add several Windows services ...
soomon's user avatar
  • 396
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/...
Marvin's user avatar
  • 55
1 vote
1 answer
41 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 ...
Jon Selby's user avatar
  • 522
-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&...
Zetka's user avatar
  • 13
0 votes
1 answer
76 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 = ...
Mykyta Halchenko's user avatar
2 votes
0 answers
83 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 ...
wdtv's user avatar
  • 33
0 votes
1 answer
33 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?
CMaker's user avatar
  • 664
0 votes
1 answer
63 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\...
Pedro Figueiredo's user avatar
0 votes
1 answer
39 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....
Emil Abbas's user avatar
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....
Nico1395's user avatar
0 votes
0 answers
65 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)....
Showechy's user avatar

15 30 50 per page