Microsoft Q&A

Entity Framework Core

420 questions

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

Browse all .NET tags

98 questions with Entity Framework Core tags

Sort by: Updated
0 answers

Executing Stored Procedures based on condition in Razor Pages

Hi, I have a function that executes two stored procedures based on a condition. Stored procedure for the first condition works fine, but stored procedure for the second condition fails. public async Task<JsonResult>…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,531 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-27T05:38:24.0033333+00:00
Blooming Developer 191 Reputation points
commented 2023-01-27T07:47:33.2466667+00:00
Olaf Helper 25,556 Reputation points
0 answers

EF Core 7 - System.InvalidOperationException

Hi, Can someone please help? I am trying to insert a record with an FK using DBContext. EF Core keeps saying that the Country is already tracked. I am aware that EF Core thinks that I am inserting a new country but that's not my intention. In the below…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-25T17:11:00.65+00:00
Raymart Atienza 1 Reputation point
0 answers

Bilgisayarıma .net 7.0 kurdum fakat powershell üzerinden dotnet tool install --global dotnet-ef komutu kullandığım zaman kurulu değil hatası alıyorum yardımcı olur musunuz

Visual Studio 2019 kullanıyorum ancak bu kurulumu yapamadım yardımcı olursanız sevinirim

Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
216 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
601 questions
asked 2023-01-24T18:58:06.7566667+00:00
Muhammed Mustafa 0 Reputation points
commented 2023-01-25T01:19:12.0633333+00:00
Jack J Jun 19,046 Reputation points Microsoft Employee
0 answers

New optional Foreign Key triggers Exception when querying

Hello there! I ran into an issue that I don't understand, therefore here I am. Here is my model: public class Property : FullAuditedEntity<Guid>, IMayHaveTenant { public int? TenantId { get; set; } …

Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
216 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-08T19:13:12.307+00:00
Julien CHEVREAU 1 Reputation point
commented 2023-01-19T07:43:30.4066667+00:00
Jack J Jun 19,046 Reputation points Microsoft Employee
0 answers

Duplicate primary key name when running Update-Database

I am using EF Core 7, with LIve Migrations enable in a code first project. I have a model using TPT strategy. When I generate the model, it gives me the error: Failed executing DbCommand (10ms) [Parameters=[], CommandType='Text',…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-16T12:43:26.89+00:00
José Luiz Berg 0 Reputation points
commented 2023-01-17T08:45:40.42+00:00
Jack J Jun 19,046 Reputation points Microsoft Employee
0 answers

Deserialising a Json string throwing error in razor pages.

Hi , I have a jsonresult like shown below "{\r\n "AccessRights": [],\r\n "ADAttributes": [\r\n {\r\n \ "AD": "teenajohn",\r\n \ "ADFull": "",\r\n …

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,531 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-17T03:35:29.02+00:00
Blooming Developer 191 Reputation points
edited the question 2023-01-17T03:39:49.52+00:00
Blooming Developer 191 Reputation points
0 answers

EF Model snapshot dev vs prod

Hi, I've an app with EF core, Model First. I created a seed data set for testing my an during the dev phase. I'd like to generate my prod DB, but the dev data are inserted in my prod db. That's an issue... I use the #If DEBUG verb to exclude data from my…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-12T10:22:25.5+00:00
Laurent Guigon 81 Reputation points
edited a comment 2023-01-12T12:29:02.8833333+00:00
AgaveJoe 17,021 Reputation points
0 answers

Huge performance difference - EF Core/Linq/C# vs 'raw SQL'

Hello I have a query using EF Core and Linq in C#. I can paraphrase the query as selecting the average item value for items that appear on an order within a date range (Order has many Items, Item belongs to 1 Order): var q = this.DbSet…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2023-01-06T16:53:17.307+00:00
Matt Gillam 1 Reputation point
commented 2023-01-11T09:27:30.9566667+00:00
Jack J Jun 19,046 Reputation points Microsoft Employee
0 answers

Add-migration Build Failed

When using EF Core 7's Add-Migration cmdlet, I encounter this error: An assembly specified in the application dependencies manifest (MyProject.deps.json) was not found: package: 'runtimepack.Microsoft.Windows.SDK.NET.Ref', version:…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 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.
6,922 questions
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
430 questions
asked 2022-12-26T16:29:59.61+00:00
Raymart Atienza 1 Reputation point
commented 2022-12-28T08:30:22.927+00:00
Junjie Zhu - MSFT 5,956 Reputation points Microsoft Employee
0 answers

Failed Executing DbCommand during Entity Framework migration in .NetCORE Web API --

I created a .netcore webapi targeting framework 3.1. Added the required classes and code in ApplicationUser and ApplicationDbContext and in startup services.AddDbContext<.......... Then I ran command add-migration IniCr which built and ran ok. But…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,531 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2022-11-30T14:25:43.23+00:00
P. G. Choudhury 1 Reputation point
commented 2022-12-17T13:25:22.6+00:00
P. G. Choudhury 1 Reputation point
0 answers

asp.net core 6 EF scaffolding

Hello, I am creating Asp.net core 6 web api with oracle 19 as backend. i am using DB first approach and create model object from DB table. i used the below syntax, scaffold-dbcontext "Data…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2022-12-15T02:48:51.417+00:00
Born2Achieve 21 Reputation points
commented 2022-12-16T03:12:41.917+00:00
Lei Zhang-MSFT 6 Reputation points Microsoft Employee
0 answers

Microsoft.EntityFrameworkCore.AutoHistory 5.0.8 not working in .net framework 6.0

Initially we have framework version 3.1 and Entity framework autohistory 2.1 Then we have upgraded the version framework version 6.0 and Entity framework autohistory 5.0.8 After upgraded framework version autohistory not working and it's throw an…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2022-12-13T12:08:52.137+00:00
SUBRAMANI Praveena 1 Reputation point
commented 2022-12-15T07:39:12.867+00:00
Lei Zhang-MSFT 6 Reputation points Microsoft Employee
0 answers

FromSqlRaw FirstOrDefault

Hello everyone and thanks for the help in advance. I am using EntityFramework Core in an application. I need to use FromRawSql to utilize pre-existing stored procedures that utilize some complex queries. However, when I use: visit =…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2022-12-13T02:56:08.257+00:00
Kmcnet 201 Reputation points
commented 2022-12-13T13:08:44.397+00:00
AgaveJoe 17,021 Reputation points
0 answers

foreign key one-to-may doesn't working in blazor wasm net. ore6

Hi, I try to implement the Foreign Key in my app to link several actions,class model ActionItem with main table Developer. When I run app the ActionItem is null. Have you some advise ? you can find github link AppWebFK When run my app I…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 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.
783 questions
asked 2022-11-23T13:44:14.33+00:00
sblb 831 Reputation points
commented 2022-12-08T18:54:05.803+00:00
sblb 831 Reputation points
0 answers

I want to scaffold dbcontext efcore in .net 6 web API from Azure Sql Database

Hello, I have an issue, i'm trying to create models from my existing database which is a azure sql database. now when i run the below command it is giving me object reference not set to an instance error and I don't know what exactly I'm passing as…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
Azure SQL Database
asked 2022-11-29T20:09:16.923+00:00
SURYA LAKKOJU 21 Reputation points
commented 2022-12-06T09:30:03.447+00:00
ShaktiSingh-MSFT 4,671 Reputation points Microsoft Employee
0 answers

4.6.1 migrating to .Net Core 7 – How do I resolve error MC1000- cannot find type System.Management.Instrumentation.InstrumentedAttribute in Assembly ..path \.nuget\packages\system.management\7.0.0\lib\net6.0\SystemManagement.dll – Microsoft.WinFx.Targets

I am migrating a .netFramework 4.6.1 application to core. I have been able to get rid of all of the build errors except this one: Error MC1000 Unknown build error, 'Could not find type 'System.Management.Instrumentation.InstrumentedAttribute' in…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
Microsoft Build
Microsoft Build
A Microsoft platform for building applications with Visual Studio and .NET on Windows.
367 questions
Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,316 questions
asked 2022-11-29T01:11:01.337+00:00
Dozier, Fletcher [US] (DS) 1 Reputation point
commented 2022-11-30T07:43:55.783+00:00
Tianyu Sun-MSFT 12,846 Reputation points Microsoft Employee
0 answers

How to migrate from entity frame work 6 to ef 7 i upgraded to ef 7 but not getting the latest features i an using repository pattern

How to migrate from entity frame work 6 to ef 7 i upgraded to ef 7 but not getting the latest features i an using repository pattern i have update to dotnet 7 and ef 7 but nothing helped

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.
6,922 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
asked 2022-11-24T05:00:33.777+00:00
dev singh 1 Reputation point
commented 2022-11-25T05:53:21.117+00:00
Zhanglong Wu-MSFT 251 Reputation points Microsoft Employee
0 answers

websecurity login not logged success althogth i have same user name and password on membership table ?

I working on c# web application i use the following code to login but it not logged success it show model state error although i have same user name and password on database so how to solve this issue please public JsonResult…

Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
216 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
.NET Standard
.NET Standard
A formal specification of .NET APIs that are available on multiple .NET implementations.
482 questions
asked 2022-11-04T15:35:01.383+00:00
ahmed salah 3,126 Reputation points
commented 2022-11-07T08:43:53.287+00:00
Zhi Lv - MSFT 18,461 Reputation points Microsoft Employee
0 answers

Second value in dropdown list

<select class="form-select" asp-for="SpareParts.Item" asp-items="@(new SelectList(Model.Stocks,"ItemCode","ItemName"))"> <option value="">select...</option> </select>…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,531 questions
asked 2022-11-01T11:29:20.07+00:00
Curious Cat 21 Reputation points
commented 2022-11-02T06:49:45.207+00:00
Zhi Lv - MSFT 18,461 Reputation points Microsoft Employee
0 answers

Another strange problem...

I am entering data into a table. During this (In the OnPostAsync scope), I do send an query to an another table, to obtain a missing data that doesn't is included in the data which comes the from. But at each try i get a strange rendered result. …

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,531 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
1,175 questions
asked 2022-11-01T12:40:44.427+00:00
Curious Cat 21 Reputation points
commented 2022-11-01T14:56:03.983+00:00
AgaveJoe 17,021 Reputation points