All Questions
Tagged with entity-framework-core .net-6.0
387
questions
-1
votes
1
answer
53
views
EntityFramework pretends to have updated a row but it doesn't
I wrote an InsertOrUpdate() method which uses my EntityFramework dbcontext and I want the method to be able to receive an object and then either insert a new row or update an existing one if it exists ...
0
votes
0
answers
26
views
EF Core discriminator generates incorrect FK migration
I have inherited a database where the structure is like this:
Table:
CREATE TABLE `address` (
`addressId` int NOT NULL AUTO_INCREMENT,
`addressType` int NOT NULL,
`instanceId` int NOT NULL,
`...
0
votes
0
answers
23
views
Return DistinguishedName using ComputerPrincipal from ActiveDirectory
I want to get the DistinguishedName using ComputerPrincipal from the Active Directory only for the user that is signed in.
With the code below the searchResultOrgUnit returns me all PC's that are ...
0
votes
0
answers
43
views
Casting foreign key in EF Core
I have a pair of related objects that are being tied through a secondary key that don't have the same type and I am trying to relate the objects together.
In essence I have something like:
public ...
0
votes
0
answers
57
views
EF Core 6 & SQL Server & .NET 6 : navigation property error
I try to migrate from NHibernate to EF Core. I added a repository pattern and migrate repo per repo. No I run into problems with navigation properties.
System.InvalidOperationException: The property ...
0
votes
1
answer
56
views
Error in IIS while publishing app locally, Entity Framework Core migrations do not work
As you see there is a command on "Entity Framework Migrations" which shows an error message:
dotnet ef dbcontext list --json
More than one project was found in the current working ...
1
vote
2
answers
29
views
.Net 6 worker service EF 6 - Repository DI cannot consume scoped service
I have below folder structure in the .Net 6 worker service with EF 6,
Solution file(.sln)
|
|_ Data(.csproj)
| |_ Models
| | |_ DatadbContext.cs
| |
| |_ Repository
| |_ DbRepository.cs
|...
0
votes
2
answers
449
views
Entity Framework Core is slow when executing the first query
I am using Entity Framework Core for the first time, and I'm getting quite confused trying to understand why is it going too slow (about 2-3 seconds) performing the first query every time I start-up ...
0
votes
0
answers
70
views
Entity Framework Core 8 throws "Method not found: 'Void CoreTypeMappingParameters..ctor" error
Recently I have migrated my project from .NET 6 to .NET 8.
I have used Migrate Assistant to upgrade my project, I am able to build solution with .NET 8 packages. I can see only following packages are ...
0
votes
1
answer
184
views
.NET Framework 4.8 (EF 6) code to .NET 6 (EF Core 6)
I am trying to convert a .NET Framework 4.8 (EF 6) app to .NET 6 (EF Core 6).
I have this method that is working in .NET 4.8:
private async Task<string> someMethod(PropertyInfo propModel, string ...
0
votes
1
answer
80
views
Entity Framework Core add relationship between view and standard model objects
This is the scenario: I use SQL Server as backend, I have an instance with a database that has some common tables that I want to join with the tables in the database of my new MVC application.
We plan ...
1
vote
1
answer
410
views
Upgrade from .NET 6 to .NET 8: Custom Context with Configuration - DB First
I want to upgrade from .NET 6 to .NET 8. I have to use DB first approach.
In .NET 6 I created a custom context to be able to pass a connectionString from the injected Configuration.
public partial ...
0
votes
0
answers
32
views
Apply constraint through EF Core to SQL Server using .NET 6.0?
I am trying to apply database validation for a property from one of my tables. This is university project, so we are required to use code first. I am using Visual Studio 2022, the project is in .NET 6 ...
-1
votes
1
answer
222
views
C# : Cannot create razor page using Entity Framework Core
I created an ASP.NET Core 6 Razor pages project in Visual Studio 2022 and when I tried to create a razor page using Entity Framework (CRUD) in the Add new scaffolded item section, I get this error:
...
0
votes
0
answers
108
views
Visual Studio 2022 connection to Teradata ODBC Driver 17.10 from Server Explorer
I am trying to connect Teradata Database from Visual Studio 2022 through Server Explorer. The connection tested successfully but when I click on table to expand It gives out an error ERROR [HYC00] [...