694 questions with Entity Framework Core tags

Sort by: Updated
1 answer

How to fix DbContextOptions resolving properly from services to apply EF migration to create database?

I'm trying to run a migration to create my initial database from code, but i'm having difficulties with proper registration of DbContextOptions. My program.cs contains the service registration: var builder = WebApplication.CreateBuilder(args); // Add…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2024-04-05T22:58:14.0533333+00:00
Vatai Domonkos 5 Reputation points
answered 2024-04-14T19:55:59.5633333+00:00
Krystian Wawruch 0 Reputation points
1 answer

Learning EF - Error running Scaffold-DbContext

I am learning how to user Entity Framework where the models are built from an existing SQL server. I ran this command in the package manager: Scaffold-DbContext “Server=xxx; database=Contoso; user id = cnnxxxxx; password = xxxx”…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2023-02-07T22:47:49.0433333+00:00
Stephen Ng Qui Sang 10 Reputation points
edited a comment 2024-04-13T20:52:12.7133333+00:00
Yash Jha 0 Reputation points
0 answers

How can we debug with InMemoryDatabase and how can we know exactly the key is duplicate?

How can we debug with InMemoryDatabase Unit test? Also I have question that when I get this error for example "An item with the same key has already been added. Key: 16c568e8-b00d-46b2-ab27-cdb7685839ae" why VS don't point exactly what entity…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,134 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,574 questions
asked 2024-04-10T08:27:15.02+00:00
Kha Vo 0 Reputation points
commented 2024-04-11T10:16:47.4033333+00:00
AgaveJoe 26,181 Reputation points
1 answer

An issue implementing migrations in the data layer

Hello I started developing a new c# WPF project. In a solution, I separated the layers as UI and Data. I placed database-related models and configurations in the data layer. Then, I gave the Data project as a reference to the ilse UI project. The problem…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,666 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,197 questions
asked 2024-04-05T08:04:08.8033333+00:00
fatih uyanık 80 Reputation points
commented 2024-04-08T05:33:09.8066667+00:00
Jiale Xue - MSFT 30,581 Reputation points Microsoft Vendor
2 answers

Nuget and The package manager on VS 2022 Community edition cannot find the Microsoft.EntityFrameworkCore

Typing Microsoft.EntityFrameworkCore into the Nuget package manager returns nothing and instead displays the NO package found message. The PM console prints the following error text when NuGet\Install-Package Microsoft.EntityFrameworkCore -Version 8.0.3…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2024-03-25T19:29:09.87+00:00
Jason Starbuck 0 Reputation points
edited the question 2024-04-02T10:00:47.44+00:00
Zhi Lv - MSFT 32,006 Reputation points Microsoft Vendor
2 answers

Single transaction, multiple service calls to Entity Framework updating database

Hi all; I have a case with a single database defined by a single Entity Framework DbContext. I have things set up where updating the database is via services. This separates things out nicely and makes it easy to mock the database for the bUnit (Blazor…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2024-03-22T15:46:31.9333333+00:00
David Thielen 2,231 Reputation points
answered 2024-04-01T20:13:59.5533333+00:00
Bruce (SqlWork.com) 54,866 Reputation points
1 answer One of the answers was accepted by the question author.

How do I create a NetTopologySuite.Polygon from a Atlas.BoundingBox?

Hi all; I need to create a Polygon so that in my Entity Framework query I can do: point.Intersects(polygon) The code to create the point is: var center = new TopologyPoint(longitude, latitude) { SRID = 4326 }; I think the code to create the…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,638 questions
Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
587 questions
asked 2024-03-26T01:11:02.51+00:00
David Thielen 2,231 Reputation points
commented 2024-04-01T18:21:58.51+00:00
rbrundritt 15,211 Reputation points Microsoft Employee
2 answers One of the answers was accepted by the question author.

Can I share a List<T> property across multiple queries via a tracking DbContext?

Hi all; Will the following work? And if so, will it provide a significant performance improvement. My AppUser object includes: public class AppUser { public int Id { get; private set; } // lots of other properties public List<Tag>?…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2024-04-01T11:06:30.0166667+00:00
David Thielen 2,231 Reputation points
commented 2024-04-01T17:20:51.4133333+00:00
David Thielen 2,231 Reputation points
1 answer One of the answers was accepted by the question author.

how to fix the error occuring when trying the Update-Database command

when I try the command Update-Database i get the error A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,344 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,574 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,638 questions
asked 2024-04-01T12:10:03.4133333+00:00
NISSOU09 40 Reputation points
commented 2024-04-01T12:45:27.4733333+00:00
NISSOU09 40 Reputation points
1 answer

Add-Migration works, but Update-Database says "no migrations to update". I tried deleting the Mig.. Folder

Visual Studio and EF Core problem. Migrations don't work. Add-Migration Title works to update the schema, but Update-Database in NuGet Command Console says that the db is already up to date, but the db does not have my new table in it. I tried…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,638 questions
asked 2023-12-31T01:49:00.7366667+00:00
John Murphy 25 Reputation points
edited a comment 2024-04-01T02:49:23.5733333+00:00
John Murphy 25 Reputation points
1 answer

How to update a record with dependency object with Entity Framework Core?

I'm studying Entity Framework Core version 8 using a Blazor project. The scenario is quite basic: I like to create a simple blog. I have an Article object that has 2 ICollection properties: Category and Tags [Table("Articles")] public class…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2024-01-05T14:37:58+00:00
Enrico Rossini 176 Reputation points
commented 2024-03-27T11:45:22.25+00:00
Talha Köse 0 Reputation points
1 answer

EF Core Tracking

Most of the articles on EF Core suggest don't enable tracking in EF Core. But if tracking is disabled in EF Core. How to add Audit Logs using EF Core Interceptors? I have tried this but looks like more re work is required for many cases where tracking…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,134 questions
asked 2024-03-13T18:06:23.0033333+00:00
net 6 newbie 121 Reputation points
commented 2024-03-26T07:53:23.4366667+00:00
Jiale Xue - MSFT 30,581 Reputation points Microsoft Vendor
1 answer

Azure deployment error when trying to install dotnet-ef

I am having trouble deploying my website to Azure due to an error with installing dotnet-ef. I have tried various versions using Nuget and the console, but I'm still unable to upload my app to the cloud. I'm following this tutorial…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,134 questions
asked 2024-03-24T11:42:29.06+00:00
BalikBalikBoom 0 Reputation points
commented 2024-03-25T14:22:43.04+00:00
BalikBalikBoom 0 Reputation points
4 answers

Error: 'Package restore failed rolling back package change for' while running Scaffold-Dbcontext in Entity Framework Core 7.0.14

Hello, I'm working on a project using .NET Core 7 and encountering an issue when running Scaffold-DbContext with Entity Framework 7.0.14. The error message I'm getting is "there was an error running the selected code generator package restore failed…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,134 questions
asked 2023-12-19T20:12:20.84+00:00
UMUT CAN 5 Reputation points
commented 2024-03-24T00:52:07.1+00:00
Hoang Nguyen 0 Reputation points
0 answers

Azure publish error install dotnet-ef

I am trying to publish a website to Azure, but I am running into an error: I do not know how to solve it. I tried to install it, but I get more errors: I also tried cmd but still no luck. command prompt At this point I have no idea what to do now. How…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,574 questions
asked 2024-01-02T20:46:56.6966667+00:00
Athenixz 0 Reputation points
commented 2024-03-22T15:07:11.19+00:00
BalikBalikBoom 0 Reputation points
3 answers One of the answers was accepted by the question author.

Blazor Server: It is possible get Current Loged User In DbContext

Hello, I build blazor server multi tenant application and I wants to use HasQueryFilter in entity framework DbContext for predefined filter with TenantId. But I cannot get Current Loged User in DbContext. I inject to DB Context…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,375 questions
asked 2021-03-17T08:54:54.227+00:00
Jan Mucha 101 Reputation points
commented 2024-03-22T11:05:31.3433333+00:00
Jacek 0 Reputation points
1 answer

Inject EntityFramework DbContext in a .NET 6 Azure Function

Where do I have to put the DbContext in a .NET 6 Azure Function? builder.Services.AddDbContext

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,211 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,574 questions
asked 2023-01-21T13:03:51.93+00:00
Bernhard Sumser 111 Reputation points
commented 2024-03-18T13:24:34.16+00:00
JV 0 Reputation points
1 answer

Working of HasComputedColumnSql() method in EF Core

I have configured the updatedAt property as shown below. I expected that the updatedAt value of the corresponding row alone will change when inserting or updating. But when tried this it is updating entire column i.e all the rows of the UpdatedAt are…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
Entity Framework Core Training
Entity Framework Core Training
Entity Framework Core: A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.Training: Instruction to develop new skills.
2 questions
asked 2024-03-09T09:52:48.4266667+00:00
net 6 newbie 121 Reputation points
commented 2024-03-17T15:00:16.96+00:00
AgaveJoe 26,181 Reputation points
2 answers

How can I address Entity Framework context disposal issues within IIS Application Pool on an Azure VM hosting an MVC application?

I am encountering an issue with the automatic disposal of the Entity Framework context within the IIS App Pool on my Azure Virtual Machine that is hosting an MVC application. The problem manifests as errors occurring on nearly all pages after a certain…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,081 questions
asked 2024-03-13T21:39:56.05+00:00
Enzo Gomes 0 Reputation points
edited an answer 2024-03-16T15:24:05.7333333+00:00
Bruce (SqlWork.com) 54,866 Reputation points
1 answer

Migration problem with immutable complex type entity for Entity Framework Core 8

I am using EF Core 8 in my project. I am trying to use an immutable complex-type entity. Here is my code: [ComplexType] public class Address(string line1, string? line2, string city, string country, string postCode) { [MaxLength(250)] …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
asked 2024-03-07T10:47:59.4566667+00:00
Nasir Uddin 41 Reputation points
commented 2024-03-13T14:50:53.97+00:00
Jiale Xue - MSFT 30,581 Reputation points Microsoft Vendor