All Questions
Tagged with entity-framework-core asp.net-core-webapi
499
questions
1
vote
0
answers
55
views
EF core code first haskey option creating both clustered index as well as unique constraint
I have a .Net Core Entity Framework code first web API solution. I am trying to create new model using code first approach. I have used "HasKey" option but it is a creating clustered index ...
0
votes
0
answers
38
views
How to use MSOLEDB in .NET Core with Entity Framework
I recently got to know that SQL native client will no longer support from SQL Server 2022 and we may need to upgrade the provider.
Please refer to this official Microsoft document:
MSDN
My application ...
1
vote
0
answers
48
views
Foreign keys in Entity Framework Core in an ASP.NET Core Web API
I have a small question and request regarding the code-first approach with Entity Framework Core.
Let's suppose I have a class A and a class B.
public class A
{
[Key]
public Guid Id { get; set;...
1
vote
1
answer
26
views
Failed to Migration while FK
I Create new fresh database and i was adding tables using EFcore Migrations following are my classes but when i migrate i run add script they run successful but when i run update they gave me error
...
3
votes
1
answer
78
views
EF Core and memory join issue
I am trying to use the EntityFrameworkCore.MemoryJoin nuget package with EF Core 8, but I always get an error when I try to use EntityFrameworkCore.MemoryJoin.FromLocalList method.
I created a simple ...
0
votes
0
answers
61
views
Delayed calling of a method
I have a method which calls a third party API, I need to check that, if the third party API takes more than three seconds to respond I want to show a delayed response in three seconds, but ...
0
votes
2
answers
54
views
Is it possible to save only relation and a definite table in a many-to-many relation with Entity Framework Core?
I am a bit new to Entity Framework Core, and I tried lots of things but I still could not solve the problem that I faced.
I have entities PicnicBag, Apple and Napkin. I created the tables with add-...
1
vote
1
answer
124
views
MigrateDatabaseToLatestVersion.Execute not working when deploying to web app in Azure but works fine locally when pointing to db in azure
I have a problem with my automatic database migrations with my ASP.NET Core 8 Web API. It works fine when running my app locally, while pointing to the SQL database in Azure, but when I deploy it to ...
-1
votes
1
answer
72
views
The exception 'The entity type 'PostEntity' requires a primary key to be defined
I am new to .NET so excuse my lack of knowledge.
I'm trying to create a simple Web API using Fast Endpoints and Ulid as id to the entities and Entity Framework Core.
Here is my code:
PostEntity.cs:
...
1
vote
0
answers
36
views
ASP.NET Core 6.0 Web API : can not update database when using EF Core lazy loading with proxies
I'm using EF Core 6.0 with lazy loading.
I have added the package Microsoft.EntityFrameworkCore.Proxies and I have added UseLazyLoadingProxies() in my DbContext:
protected override void OnConfiguring(...
0
votes
1
answer
77
views
How to create a sequential number service with unique numbers in ASP.NET Core Web API, Entity Framework Core, and PostgreSQL?
Two days ago I posted this question, I don't think I explained the problem right, so I will try to explain it better here.
Let's say I want to create a service, which returns a unique number when a ...
0
votes
0
answers
67
views
ASP.NET Core Web API launches on a wrong Url
I am using EF Core, and after making some changes to the models and DbContext and running
dotnet ef database update -p Project_Name
when I run the API, it launches a different url; it should run on ...
0
votes
1
answer
50
views
Data is Null. This method or property cannot be called on Null values. when dbcontext.codeddata
I am calling the stored procedure from .NET Core:
[Authorize(Roles = "1,2,3")]
[HttpPost("SaveDocumentAndParties")]
public async Task<IActionResult> saveDocumentAndParties([...
0
votes
0
answers
17
views
EF Core Update Successful But throws an Exception in Update [duplicate]
I am reading a CategoryType object from the database (in a controller method for update).
CategoryType categoryType1 = await CategoryType.GetById(databaseService, ID, UserId);
And then update the ...
1
vote
0
answers
91
views
Execution timeout error in ASP.NET Core Web API with EF Core
I have an ASP.NET Core Web API project using EF Core for database related operations. The database is hosted in Azure and I am using SQL Server authentication to get access to my database and for ...