Category "entity-framework-core"

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

SQLite Error 14: 'unable to open database file' with EF Core code first

I am getting an SQLite Error 14: 'unable to open database file' with EF Core code first, no idea why. I worked fine the first time, the database file got crea

What would cause a for / foreach loop to break without explicitly calling a break?

I have a durable function that calls a method that simply adds a row to an efcore object. It doesn't call db save. When I step through the code, and get to the

Add entity data model (edmx file) to .net core API

I have .Net Core 5.0 API project contains another .Net Core Class Library. Also I have exiting SQl Server Database. How can create edmx using .net core project

Entity Framework Long Timeout on Queries from Azure PostgresSQL DB

I am having an issue with excessivly long timeouts with calls to an Azure PostgresSQL server. On rare occasions, the call to the database will take approximate

Entity Framework Core error "Column names in each table must be unique"

I have manually added the column IdCategory to my table Books, and now each time I try to run Update-Database, I get this error: fail: Microsoft.EntityFramewor

How to set threading mode in SQLite with Entity Framework?

I'm using SQLite with Entity Framework Core (RC1). I read, that SQLite supports three different threading modes: Single-thread, Multi-thread and Serialized.

The required column was not present in the results of a 'FromSql' operation

I've just starting learning MVC6 with EF7. I have a stored proc that I'd like to return a portion of the fields that are in my model. If I don't return every

How to customize migration generation in EF Core Code First?

There is a special base table type in my DbContext. And when inherited from it I need to generate an additional "SQL" migration operation to create a specific t

How to get only specific tables to create models from database with Entity Framework Core in C#

I'm using Scaffold-DbContext to create models from an existing database, but it auto pluralizes the table names and I don't want that. It also gets all the tabl

.net core injecting and resolving services

I am trying my hand at .net core web api. I have created a static method for registering my controllers like this: public static class RegistrationExtensions {