All Questions
Tagged with entity-framework-6.1 or entity-framework-6
11,224 questions
0 votes
1 answer
106 views
Trying to populate very similar relations through same property
I am trying to define two classes with the same collection-relation, through the same key on a third class, preferably using EF 6 code annotations. I have three tables; Current is a quick reference. ...
3 votes
0 answers
47 views
How can I force EF6 to create a test database from the current model, bypassing migrations?
I am setting up an automated integration test environment for a large, existing Entity Framework 6 project that uses a MySQL database. My goal is to create a fresh, empty database schema directly from ...
2 votes
2 answers
116 views
AsNoTracking when selecting Non-Entities
Still on EF 6 "classic" (not core), when I do something like the following: var basicPersonList = myContext.Persons .Select(p => new PersonSimpleData { FamilyName = p....
-2 votes
1 answer
97 views
EF6: optional foreign key always null
I have a C# (C# 7.5) application that is using EF6. I have a table that contains two foreign keys. Both are one:one relationships and both are required. When I load a record from the database, the ...
1 vote
1 answer
160 views
How to prevent foreign keys to be set null after calling Remove on an Entity
I have an Order table that contains a nullable foreign key to another table called Product (each order can only map to one product). Each order will only point to one product. The relation is ...
0 votes
0 answers
65 views
C# Entity Framework COM Object accessed from Delphi Error [duplicate]
After installing Windows 11 Update 24H2, I have not been able to work with a COM Library developed with C# and accessed from Delphi. The failure occurs when I do a Where filter using a numeric ...
-1 votes
2 answers
68 views
Error CS0246 when defining a database connection
I'm using VS2022 and have an ASP.NET MVC project with Entity Framework 6. All Nuget packages are current. I have a data connection InstrumentEntities; in the Server Explorer, I can see all the tables ...
1 vote
1 answer
98 views
How to map a parent-child relationship where the child type depends on the parent's discriminator field, with Entity Framework 6?
I need to map an existing database using Entity Framework 6 in order to read (only) data. The model that bugs me is kind of a TPH inheritance strategy where the child type depends on a discriminator ...
1 vote
0 answers
51 views
Hangfire Autofac Job Can't Resolve DbContext: ComponentNotRegisteredException in BackgroundScope
I'm working on a .NET Framework 4.6.1 application using Autofac (5.2.0) for dependency injection and Hangfire for background jobs. I have a service class StoreDataCleanupService that depends on an EF ...
1 vote
1 answer
64 views
ASP.NET Core Web API controller method throws 'transient failure'
Using Entity Framework 6 in an ASP.NET Core Web API. I have the following controller: [Route("[controller]/[action]")] [ApiController] public class ContactController : ControllerBase { ...
0 votes
0 answers
102 views
Same projection mappping in IQueryable.Select but with Varied Child Collection filters in EF6
I have methods used in IQueryable.Select(...) that shares the same logic of mapping an Entity class to a DTO class, but filter the navigation properties in the projection differently. The problem is ...
0 votes
1 answer
78 views
Explicitly Loading filtered navigation property via Load() not working
I have a query that I want to return an entity with a filtered collection navigation property. According to the EF6 document I should be able to load it via explicit loading. However, after the ...
0 votes
2 answers
149 views
How to make LINQ query faster
Running NbLinksExpirationStatus takes about 12 seconds to execute, which is not fast enough for what i am trying to achieve. Could it be Contains() problem and is there any way i can make it execute ...
1 vote
1 answer
238 views
Workaround in Entity Framework 6 for keyless tables
We have a .NET Framework 4.8 application that uses Entity Framework 6. Now we are having a problem that we need to add some tables that don't guarantee any uniqueness (no primary key and rows can ...
1 vote
0 answers
40 views
Assembly Binding Redirect handling for ef6.exe outside of Package Manager Console
I have a C# / ASP.NET MVC project using Entity Framework 6. When I am deploying database migrations by running Update-Database -Verbose in the Package Manager Console in Visual Studio, everything ...