Microsoft Q&A

Entity Framework Core

480 questions

A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.

Browse all .NET tags

480 questions with Entity Framework Core tags

Sort by: Updated
0 answers

Blazor Server App crashes if DBContext is used

I have a Blazor Server App that runs fine in the VS Web Server but crashes hard when deployed to an IIS 10 Web Server running on a Windows Server 2022 Machine. I have reviewed my use of Entity Framework DBContexts and all are created and disposed very…

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
890 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 questions
asked 2023-03-31T17:31:54.6466667+00:00
Jim G 0 Reputation points
1 answer

how to replace replace IObjectContextAdapter with IInfrastructure<IServiceProvider> using entity framework core 6

Hi Team, since IObjectContextAdapter is not supported by entity framework core 6 please suggest the replacement code which supports the below code - using (var db = new BloggingContext()) { var blogs =…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-29T11:47:17.0866667+00:00
Firke, Yogesh (Cognizant) 0 Reputation points
answered 2023-03-30T04:24:51.5566667+00:00
Jack J Jun 22,381 Reputation points Microsoft Vendor
3 answers

Error In Update Record (The instance of entity type 'x' cannot be tracked)

I have this error when update record in RoleRepository.cs. i use AsNoTracking but show error again The instance of entity type 'ApplicationRole' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked.…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2022-02-20T11:47:53.197+00:00
Mahdi Elahi 21 Reputation points
commented 2023-03-27T10:19:09.1633333+00:00
Sherali Jurayev 0 Reputation points
1 answer

ASP.NET Core MVC : complex data model reading related data

I am trying to display a drop-down on my DEVICES create.cshtml view of the names from CONTACT via the lookup table DeviceAssignments, below is an ERD. I am already able to display the drops downs for DeviceCategories and DeviceLocations, but I am not…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
ASP.NET MVC
ASP.NET MVC
A Microsoft web application framework that implements the model-view-controller (MVC) design pattern.
744 questions
asked 2023-03-16T17:21:00.64+00:00
tjestesjr77 20 Reputation points
edited a comment 2023-03-24T18:05:49.4733333+00:00
AgaveJoe 20,306 Reputation points
1 answer

Turning off cascade deletes

I have a case where I need to turn off cascading deletes (two different models are both wanting to cascade delete and so one needs to be turned off). I think I have this right but I saw numerous different answers all over the place and so want to…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-19T18:37:30.1933333+00:00
David Thielen 691 Reputation points
commented 2023-03-24T16:10:31.27+00:00
David Thielen 691 Reputation points
0 answers

Entity Framework, nullable, and no warnings or hacks

I am trying to get my model constructors written so that nullable works, with no warnings, and no having to assign default! - in other words, to do it all right. BTW, if I'm wrong on any of this, please let me know. I'm mostly there. What's left is…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-19T18:39:22.8866667+00:00
David Thielen 691 Reputation points
commented 2023-03-24T13:14:52.9866667+00:00
Jack J Jun 22,381 Reputation points Microsoft Vendor
1 answer

.NET 6.0 migration issues leads to MySQL stored procedure calling

Once we migrate .NET core 3.1 applications to .NET 6.0, we get below issue while calling MySQL stored procedure, The LINQ expression could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: The period of time during which a program is being executed in a computer.
982 questions
asked 2023-03-22T14:29:14.39+00:00
Ninad Manjrekar Offcial 0 Reputation points
commented 2023-03-23T14:06:06.17+00:00
Michael Taylor 41,431 Reputation points
2 answers One of the answers was accepted by the question author.

HasDefaultValueSql("getutcdate()").ValueGeneratedOnAdd(); not working as expected

I configure my model as follows: public class CampaignConfiguration : IEntityTypeConfiguration<Campaign> { /// <inheritdoc /> public void Configure(EntityTypeBuilder<Campaign> builder) { builder.HasIndex(new[] {…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-19T18:40:51.34+00:00
David Thielen 691 Reputation points
commented 2023-03-22T16:39:09.4433333+00:00
David Thielen 691 Reputation points
1 answer

How to share Cosmos Document DB Container with Blazor Server App And Cosmos Change Feed Function App using Entity Framework (EF)?

I have a Blazor Server App that uses Entity Framework Core to manipulate my Cosmos Container and I want to incorporate an azure change feed. I have created an Azure Change Feed Function App using the Visual Studio 2022 (Preview). This is configured with…

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
890 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
985 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,812 questions
asked 2023-03-17T20:34:26.8333333+00:00
Siegfried Heintze 1,411 Reputation points
edited a comment 2023-03-22T01:24:23.1566667+00:00
Siegfried Heintze 1,411 Reputation points
1 answer One of the answers was accepted by the question author.

How write this query in EF Core or Linq

Hello, I want to write this query in linq or lambda EF core SELECT LAG(id) OVER ( ORDER BY ID ) AS PreviousWord ,ID ,LEAD(id) OVER ( ORDER BY ID ) AS NextWord FROM sales Please help

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2021-07-28T16:48:16.987+00:00
Prathamesh Shende 306 Reputation points
commented 2023-03-21T21:19:58.08+00:00
Prathamesh Shende 306 Reputation points
1 answer One of the answers was accepted by the question author.

How to save a many to many relationship with Entity Framework

Hi, I have a many to many relationship between Flight and Journey, so I have created an intermediate table to create the relationship: the thing is, I have a list of flights and one Journey, so how can I create the code to make the assembly so I can…

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.
7,621 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-21T00:31:43.34+00:00
Jhon Hernandez 21 Reputation points
accepted 2023-03-21T14:47:36.57+00:00
Jhon Hernandez 21 Reputation points
0 answers

Controller necessary for creating database / Entity Framework

if I create a property set under models and list it in the context class and run a migration and database update the database is not created (as observed through MSSMS). If I create a controller using entity framework in between creating a property set…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 questions
ASP.NET MVC
ASP.NET MVC
A Microsoft web application framework that implements the model-view-controller (MVC) design pattern.
744 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-20T13:24:31.3933333+00:00
Dean Everhart 926 Reputation points
commented 2023-03-21T02:06:50.55+00:00
Zhi Lv - MSFT 21,806 Reputation points Microsoft Vendor
1 answer

EF Core 7.0 with a SQL Table (DB First) having an Identity Column and a Computed Column (Primary Key)

Hi There, I have a fairly simple table in SQL DB as below [dbo].TBL_CUST ColumnCommentsIDInt; Identity (1, 1)D_IDComputed column Calculated as = "DID" + RIGHT('000' + Cast(ID as varchar(3)) , 3) i.e.... Like DID001 / DID019 etc...NameVarchar…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
231 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.
890 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.
7,621 questions
asked 2023-03-15T17:23:05.2+00:00
amjee84 6 Reputation points
commented 2023-03-20T23:17:54.38+00:00
Karen Payne MVP 30,441 Reputation points
0 answers

Managing UI CRUD Operations With High Number Of Parent/Child Entities

Hello, I am creating a Knowledge Base application using .Net Core 6, Razor Pages (Non-MVC), Entity Framework Core and SQL Server. I have created a Repository Pattern and am using Unit of Work, in an N-Tier architecture. Each Knowledge Base…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 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.
7,621 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
907 questions
asked 2023-03-17T21:11:47.43+00:00
Brian Ashcraft 100 Reputation points
commented 2023-03-20T02:44:16.2433333+00:00
Zhi Lv - MSFT 21,806 Reputation points Microsoft Vendor
2 answers

GROUP BY together with ORDER BY MAX in Entity Framework Core using LINQ

Let's assume these 2 classes and corresponding DB tables. public class Ticket { public int Id { get; set; } public string Title { get; set; } public bool IsFinished { get; set; } } public class ReportedTime { public int Id { get; set; } …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-17T17:16:58.71+00:00
David-6289 0 Reputation points
answered 2023-03-18T17:45:06.6166667+00:00
David-6289 0 Reputation points
1 answer

EntityFramworkcore.sqlserver installation Problem

EntityFramework.SqlServer can't be isntall ....Getting so many error..

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,855 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-15T21:00:15.98+00:00
Hari Om Singh 20 Reputation points
commented 2023-03-16T01:45:55.2066667+00:00
Farid Uddin Kiron MSFT 281 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

ADO entity data model is missing Visual studio 2022

I have installed entityframeworkcore 7.0.3 but ADO.net data model not show in data template

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-10T19:31:29.7+00:00
Hari Om Singh 20 Reputation points
accepted 2023-03-15T21:03:07.9466667+00:00
Hari Om Singh 20 Reputation points
2 answers

How should I structure my Entity Framework access/query classes

I've placed all my EF model classes that represent my tables in the Models folder along with my DbContext class - as recomended. I now want to create a class for each table that access the DB using DbContext and the appropriate model class. This is the…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-11T19:43:24.1166667+00:00
David Thielen 691 Reputation points
commented 2023-03-15T18:07:59.8066667+00:00
Karen Payne MVP 30,441 Reputation points
3 answers One of the answers was accepted by the question author.

Is there a way to say an entry is unique across 2 column values?

My question is in the context of Entity Frameworks talking to SQL Database. I have a class as follows: public class County { public int Id { get; set; } public string Name { get; set; } public int StateId { get; set; } …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 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.
9,175 questions
asked 2023-03-10T00:03:02.3+00:00
David Thielen 691 Reputation points
commented 2023-03-15T01:06:42.6833333+00:00
David Thielen 691 Reputation points
2 answers

Is Entity Frameworks Core + fluent superior to ADO.NET?

Hi all; I've been fighting Entity Frameworks Core + fluent for about a month now on a new project working to create my model, etc. I have a couple of decades experience using ADO.NET. So I'm comparing the two. Granted, the first project is going to be…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
480 questions
asked 2023-03-11T19:34:28.7333333+00:00
David Thielen 691 Reputation points
commented 2023-03-14T15:02:11.1666667+00:00
David Thielen 691 Reputation points