Category "entity-framework-core"

Scaffold-DbContext runs successfully but does not create any models

I am using Visual Studio community edition 2022 and trying to update my Models from database in EntityFrameworkCore 6 (I added new tables and modified some). Wh

How to write Repository method for .ThenInclude in EF Core 2

I'm trying to write a repository method for Entity Framework Core 2.0 that can handle returning child collections of properties using .ThenInclude, but I'm havi

Lazy loading in EFCore loads all the data even if not accessed

I have been trying to use lazy loading in ASP.NET core 6, I have followed the documentation to do so. However, the behavior of the lazy loading is not the same

Why is my Blazor Server App waiting to render until data has been retrieved, even when using async?

I'm building a Blazor Server app using .NET 6. As an example I have a list of customers that I retrieve from a Sqlite db using Entityframework Core. I want to s

A fatal error occurred. The required library libhostfxr.dylib could not be found

I'm working on ASP.NET Project with .NET 5.0. For Database creation, I've run the command dotnet tool install --global dotnet-ef After the installing, when I

The property 'PropertyName' could not be mapped, because it is of type 'List<decimal>'

I got this problem when I try to create the database with EntityFramework Core: The property 'Rating.RatingScores' could not be mapped, because it is of typ

Microsoft.Extensions.Hosting.HostFactoryResolver+HostingListener+StopTheHostException

I'm using Asp.Net Core Web Api 6 I'm facing an error when migrating my DbContext and when updating the database The Error [17:07:29 INF] Application Is Starting

options.UseSqlServer returns Error in startup.cs

I'm developing a test Project using asp.net core. For Connecting to database I'm using Entity framework. I add appsetings.json file to the project and change th

EF Core 2.1 - No database provider has been configured for this DbContext

I have ASP.Net Core 2.1 with EF Core 2.1. This is how my DbContext class looks like app.DAL.EF -> Layer using app.domain; using Microsoft.EntityFrameworkCo

Problem Changing the value of nested ValueObject using C# 10, .NET 6 and EF Core 6

My Aggregate is like this: public class Order : AggregateRoot { private readonly List<OrderItem> _items = new(); public DateTime Date { get; set;

Update ContextModelSnapshot EF Core

I'm newer to EF Core, so please forgive me if there is a trivial answer. Take this scenario.... A new web-application is being developed using the latest vers

What is the best way to perform partial updates in EF core and never update certain properties?

I know you can do something like var myObj = _db.MyTable.FirstOrDefault(x=>x.Id==id) and then update myObj property by property that you want to update but i

SQL Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

I am using Microsoft.EntityFrameworkCore.SqlServer 2.2.6. I have a stored procedure which typically takes 1 to 2 seconds to execute. I am using .NET Core 2.2 wi

Store Entity Framework Core SQLite file in project-relative subdirectory

I have an ASP.NET Core 2.0 app using Entity Framework Core and the SQLite Provider. I am trying to store the SQLite database file in a subdirectory (specificall

EF Core NodaTime field - could not be mapped

I'm using EF Core with <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" /> I've just added a NodaTime.LocalDate field to

ef core angular - is there a way to get and display data from database in input box depends on another input box

First Input Box will ask the user to enter employee number Second Input Box (readOnly) - employee name will be display here automatic base on employee number pr

ASP.NET model that requires a reference to a IdentityUser?

I have a model Blueprint that requires a reference to an IdentityUser. When I run Add-Migration CreateBlueprintSchema the following error is thrown: No suitabl

How do I get an IDbTransaction from an IDbContext?

An IDbContext has a DatabaseFacade, which has a CurrentTransaction property. But the CurrentTransaction is an IDbContextTransaction. I want to pass an IDbTransa

Entity Framework Core 5 - Single Navigation Property

I'm using Entity Framework Core 5 and I'm having problems retrieving records with all of their associated related data. As you can see below, I have three clas

Include all navigation properties using Reflection in generic repository using EF Core

I'm working on creating a generic repository for an EF Core project to avoid having to write CRUD for all models. A major roadblock I've hit is navigation prope