Microsoft Q&A

Entity Framework Core

425 questions

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

Browse all .NET tags

425 questions with Entity Framework Core tags

Sort by: Updated
0 answers

EF Core query for a specific condition in related entities and update parent entity

Hello there, In my Blazor Server application, I have Order and Order Details entities which are related as you can imagine. They both have their own repositories. public class Order { public int Id { get; set; } [Required] …

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
795 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-02-04T19:08:18.7033333+00:00
Cenk 686 Reputation points
edited a comment 2023-02-05T11:54:42.3633333+00:00
AgaveJoe 17,296 Reputation points
1 answer One of the answers was accepted by the question author.

EF Core 6 - Adding records based on a condition

Hi friends, In my Blazor server application, I am inserting BulkPurchaseRequest records into DB as follows. public class BulkPurchaseRequestsRepository : IBulkPurchaseRequestsRepository { private readonly OyunPalasContext _oyunPalasContext; …

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,585 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 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.
795 questions
asked 2023-02-01T17:33:09.4066667+00:00
Cenk 686 Reputation points
commented 2023-02-04T09:04:35.3033333+00:00
Cenk 686 Reputation points
1 answer

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.
425 questions
Microsoft Build
Microsoft Build
A Microsoft platform for building applications with Visual Studio and .NET on Windows.
369 questions
Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,327 questions
asked 2022-11-29T01:11:01.337+00:00
Dozier, Fletcher [US] (DS) 1 Reputation point
answered 2023-02-03T21:47:03.9733333+00:00
Hardik Patel 0 Reputation points
1 answer

I can't use class on layered architecture

I'm working on a web.api for library otomation project. I'm using layered architecture on project. a485553e-89a6-4fa9-8dd5-1c40de6d40e2.jpg image is my architecture. I couldn't access User.cs class on DataAccess layer. I defined with "usign"…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,585 questions
asked 2023-02-02T07:05:02.2466667+00:00
ömercan künye 0 Reputation points
commented 2023-02-02T09:34:24.4166667+00:00
Viorel 82,911 Reputation points
3 answers

EF Core - Getting records randomly based on a certain criteria

Hi there, I would like to get data one by one (TOP 1) where all the statuses of all related BulkID = 1 randomly. Here is what I tried but didn't work as I wanted. Select TOP 1 BulkId, ProductCode from BulkPurchases where status = 1 group by…

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,565 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,003 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-02-02T05:25:23.99+00:00
Cenk 686 Reputation points
answered 2023-02-02T06:19:31.5633333+00:00
打玻璃 1,526 Reputation points
4 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,585 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-01-17T03:35:29.02+00:00
Blooming Developer 196 Reputation points
answered 2023-02-01T20:11:29.9466667+00:00
Bruce (SqlWork.com) 28,276 Reputation points
0 answers

Entity Framework 框架问题

dbcontext不同的实例,savechanges被互相影响怎么回事

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
631 questions
asked 2023-01-31T08:38:53.5766667+00:00
赐 张 0 Reputation points
commented 2023-02-01T03:23:52.2166667+00:00
Jack J Jun 19,376 Reputation points Microsoft Employee
2 answers

EF Core 6 Adding a table manually?

Hello friends, I am working on a web API project that I implemented with the code-first approach. I wonder if there is a problem creating tables manually without using migrations. Does it cause any problems? Thank you.

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-01-17T14:19:19.31+00:00
Cenk 686 Reputation points
commented 2023-01-31T09:49:26.6633333+00:00
Cenk 686 Reputation points
1 answer

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,585 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-01-27T05:38:24.0033333+00:00
Blooming Developer 196 Reputation points
answered 2023-01-31T09:42:26.0866667+00:00
Blooming Developer 196 Reputation points
1 answer

JSON Format WebAPI Entity Framework

Currently the JSON I'm using looks like this: The JSON file is huge so I'm only showing the first few rows in the file so not all data is shown. I'd like to get this JSON structured so I can use in a TreeView menu so I'd like to see get the out put to…

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,003 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
150 questions
asked 2023-01-19T16:31:09.4066667+00:00
TheCoder 91 Reputation points
commented 2023-01-31T09:34:35.88+00:00
Lan Huang-MSFT 9,281 Reputation points Microsoft Employee
2 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.
425 questions
asked 2023-01-16T12:43:26.89+00:00
José Luiz Berg 0 Reputation points
answered 2023-01-31T00:02:19.27+00:00
José Luiz Berg 0 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.
425 questions
asked 2023-01-25T17:11:00.65+00:00
Raymart Atienza 1 Reputation point
commented 2023-01-30T08:08:59.7066667+00:00
Jack J Jun 19,376 Reputation points Microsoft Employee
1 answer One of the answers was accepted by the question author.

How to use EF Core when two properties in the Principle entity point to the same attribute in the dependent entity?

I have 2 Model classes: Department.cs cs public class Department { public string DepartmentId { get; set; } public string Name { get; set; } public string Description { get; set; } [ForeignKey("FacultyId")] public…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,585 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2021-11-01T04:16:37.687+00:00
Uchchay Dugal 21 Reputation points
accepted 2023-01-29T15:05:43.83+00:00
Uchchay Dugal 21 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<DataContext>(options => // options.UseSqlServer(context.Configuration.GetConnectionString("BlazorOrderApp"))); There is…

Azure SQL Database
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
2,442 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,605 questions
asked 2023-01-21T13:03:51.93+00:00
Bernhard Sumser 101 Reputation points
edited a comment 2023-01-28T22:06:26.2366667+00:00
Bernhard Sumser 101 Reputation points
1 answer One of the answers was accepted by the question author.

Stored Procedures returning null value in razor pages

Hi, i have two stored procedures which will execute based on the condition. First Stored Procedure : AvailableHourSlots CREATE PROCEDURE [dbo].[AvailableHourSlots] @ActivityName nvarchar(max) , @BookedDate datetime2(7) AS SELECT distinct…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,585 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-01-26T03:05:34.77+00:00
Blooming Developer 196 Reputation points
commented 2023-01-26T08:16:53.57+00:00
Blooming Developer 196 Reputation points
2 answers One of the answers was accepted by the question author.

EF Core 6 - Truncate Table

Hi, How can I use the truncate table in EF Core 6? I tried this but didn't delete rows. _oyunPalasContext.RazerReconciliation.FromSqlRaw("TRUNCATE TABLE RazerReconciliation");

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,003 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
asked 2023-01-25T06:54:42.34+00:00
Cenk 686 Reputation points
answered 2023-01-25T11:22:57.64+00:00
Karen Payne MVP 29,236 Reputation points Microsoft MVP
1 answer

Blazor Server - System.InvalidCastException: Unable to cast object of type 'System.Double' to type 'System.Single'.

Hi, In my Blazor server application, I am trying to get the records from RazerReconciliation table as follows. I couldn't figure out why I am getting this error. public async Task<List<RazerReconciliations>> GetOldReconsAsync() { var…

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
795 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 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,003 questions
asked 2023-01-25T06:21:35.1233333+00:00
Cenk 686 Reputation points
edited an answer 2023-01-25T06:42:04.0533333+00:00
Viorel 82,911 Reputation points
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 Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
219 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
631 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,376 Reputation points Microsoft Employee
2 answers

Entity Framework Core can't create migrations table using created login

I am doing a some training with .Net 6.0, C# and Entity Framework Core. I got to the point that EF can generate a new migration but hen I run dotnet ef database update I am getting an error: Failed executing DbCommand (38ms) [Parameters=[],…

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,003 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
631 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.
8,565 questions
asked 2023-01-22T07:41:22.5733333+00:00
Yiyi Chen 0 Reputation points
answered 2023-01-24T07:46:24.52+00:00
Yiyi Chen 0 Reputation points
4 answers

SQLAzure is not available for your selection of subscription and location

Hi Folks, Trying to use Azure for the first time, I'm using a normal account (i.e not free tier or student) but it is just for a hobby project. I'm following the tutorial here in order to deploy my EFCore webapi…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,585 questions
Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
425 questions
Azure App Services
Azure App Services
A feature of Azure App Service used to create and deploy scalable, mission-critical web apps.
4,324 questions
Azure SQL Database
asked 2023-01-22T08:33:29.6833333+00:00
Gary Frewin 5 Reputation points
answered 2023-01-24T04:45:49.5733333+00:00
Joshua Davies 1 Reputation point