Questions tagged [entity-framework]
For questions about Entity Framework for .net framework, max. version 6.4, December 2019. Use [entity-framework-core] for current .net (core) versions. Then also please add a version-specific [ef-core-xx] tag.
entity-framework
91,869
questions
0
votes
0
answers
8
views
How to create 3 tables using EF OData concept, without foThe title key reference constraint in C table
For example A, B, C are 3 tables I want to create in A table 1 column collection of id's in B table primary key.
B table has details of that id's.
C table 2 primary keys only that is A & B tables....
0
votes
1
answer
39
views
ASP.NET Core Web API : entity doesn't get saved to database
I am creating a basic ASP.NET Core Web API which contains a list of countries/locations/places of interest.
I have created all the methods for location which are a child of the country object and ...
0
votes
1
answer
36
views
System.NotSupportedException: Versions of MySQL prior to 5.6 are not currently supported
I am not able to connect to MariaDB with EF. I am using libraries:
MySql.Data v9.0.0
MySql.Data.EntityFramework v9.0.0
MariaDB version: 10.5.8-MariaDB-log
My app.config
<entityFramework>
&...
1
vote
1
answer
29
views
why modelstate.isvalid always false despite the picture property in model getting assigned
I'm working on a razor pages project. I have an employee model which has a picture property of type byte array. Despite picture being assigned byte array when I check modelstate.isvalid, emp.picture ...
0
votes
1
answer
49
views
dotNET minimal API getting 404 not found on a secure endpoint
I am trying to implement a rest api using the dotNET framework. I am experiencing a problem with the "/secure" endpoint, getting 404 as a response message whether I login or not.
If I don't ...
1
vote
1
answer
52
views
LINQ group with list inside shows only the first row
I have a view in the v_PortalProprietario database that returns in each line the name of the owners that are repeated and the accounts (Acertos) that are unique. I would like to make a query in Linq ...
0
votes
0
answers
35
views
Testcontainers is spinning up server but not creating the schema
I am trying to create a project for my integration tests, that spin up a test container using docker. I'm also trying to then create my SQL Server. It creates the SQL Server fine, but its not creating ...
0
votes
2
answers
56
views
How to join tables and group the results using LINQ?
I have a table of Products and a table of Product_Images with a one to many relation (one product can have multiple images) and I am trying to retrieve all products with their related images. So far I ...
0
votes
1
answer
54
views
Pagination on the result from multiple collection .net
I am trying to add offset pagination( input is pagesize and limit) on combined result which is aggregating multiple collections. Earlier I had only limit on the reponse. Below is the code for the API ...
0
votes
3
answers
79
views
Sequence contains no elements in LINQ
In the code shown here, I am getting an error in LINQ:
Sequence contains no elements
When the reason column contains data, it is throwing this exception. Please suggest how to handle this exception.
...
0
votes
0
answers
57
views
.NET Core dependency injection Entity Framework lazy loading not available after insert / update
We were using a separate DbContext per function like this:
using MyEntities db = new();
This was fine, however since we have swapped to dependency injection, we have found that since the DbContext ...
0
votes
3
answers
58
views
Entity Framework C# join with one column only from second table
I have a join in Entity Framework connecting the Order and the OrderItem tables. All orders will have multiple order items. I'm trying to return all the orders, but only the orderItemStatus column ...
0
votes
1
answer
46
views
How do we reference the dbContext from the Application layer in DDD for queries?
Here are the assumptions that I have gathered via extensive research:
"Domain models are separate to persistence entities."
"Repository Pattern's best use-case is on the command (write ...
0
votes
0
answers
26
views
Need to order by list using row value using entity framework [duplicate]
I have data in following format as shown in the sample table data. I want to order by this data in ascending order for ND values.
Means like from ND1 to ND10.
I tried the following way:
return await ...
0
votes
0
answers
21
views
'Skip navigation doesn't have an inverse navigation configured' error when migrating
I am working on a C# Web API project and when attempting to Add-Migration, I keep getting this error:
Unable to create a 'DbContext' of type ''. The exception 'The skip navigation 'Class.Staffs' doesn'...