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

420 questions with Entity Framework Core tags

Sort by: Updated
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,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 2021-11-01T04:16:37.687+00:00
Uchchay Dugal 1 Reputation point
accepted 2023-01-29T15:05:43.83+00:00
Uchchay Dugal 1 Reputation point
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
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
2,398 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
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,577 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
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
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,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-26T03:05:34.77+00:00
Blooming Developer 191 Reputation points
commented 2023-01-26T08:16:53.57+00:00
Blooming Developer 191 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
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.
6,923 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-25T06:54:42.34+00:00
Cenk 666 Reputation points
answered 2023-01-25T11:22:57.64+00:00
Karen Payne MVP 29,226 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.
783 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
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,923 questions
asked 2023-01-25T06:21:35.1233333+00:00
Cenk 666 Reputation points
edited an answer 2023-01-25T06:42:04.0533333+00:00
Viorel 82,381 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.
420 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
601 questions
Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
216 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
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=[],…

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,472 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,923 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-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…

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 Web Apps
Azure Web Apps
A feature of Azure App Service used to create and deploy scalable, mission-critical web apps.
4,306 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
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
2 answers One of the answers was accepted by the question author.

Scaffold-DbContext probleme authentication integrated security

Hello I want scaffolding my azure sqserver database, but when i run this command : Scaffold-DbContext "Server=MydataBase.database.windows.net;Database=dev-base;Integrated security=true;Authentication=Active Directory Integratd;User…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
420 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,472 questions
Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
12,583 questions
asked 2023-01-19T09:39:59.9066667+00:00
jimomo 20 Reputation points
accepted 2023-01-23T16:32:57.72+00:00
jimomo 20 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.
6,923 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 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.
144 questions
asked 2023-01-19T16:31:09.4066667+00:00
TheCoder 91 Reputation points
commented 2023-01-22T14:53:49.3+00:00
TheCoder 91 Reputation points
4 answers

Porting Entity Framework 6 to Entity Framework Core

I am porting an application from ASP.net MVC 5 to ASP.net Core MVC and I reach out in the area pointing the Entity Framework related modules. I have the generated classes and I also have the edmx and tt files, I added the files to a newly created Class…

Entity Framework 6.0
Entity Framework 6.0
A Microsoft open-source object-database mapper for .NET.
216 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
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 MVC
ASP.NET MVC
A Microsoft web application framework that implements the model-view-controller (MVC) design pattern.
582 questions
asked 2023-01-20T16:28:32.4533333+00:00
cebuhax0r 21 Reputation points
answered 2023-01-22T14:35:37.99+00:00
Karen Payne MVP 29,226 Reputation points Microsoft MVP
2 answers

CreateFunction Like

Hi, I need an example about CreateFunction for like Could you give me an example ? https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/user-defined-functions

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-14T18:03:38.4233333+00:00
SUAT SUPHI 21 Reputation points
edited an answer 2023-01-19T09:30:45.19+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
5 answers

SQL Bulk Insert Problem while inserting excel data

Hi guys, In my Blazor Server application, I am trying to insert excel data into a SQL database table. I am getting this error, but couldn't figure out why. Hope you can help me. Error: The given ColumnName 'PID' does not match up with any column in data…

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
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,472 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,923 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-18T11:41:22.24+00:00
Cenk 666 Reputation points
commented 2023-01-19T06:33:23.6533333+00:00
Cenk 666 Reputation points
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.
420 questions
asked 2023-01-17T14:19:19.31+00:00
Cenk 666 Reputation points
edited a comment 2023-01-18T05:25:03.6933333+00:00
Cenk 666 Reputation points
1 answer

Blazor Server - SQLBulkCopy Excel data into SQL Server table

Hello folks, I am working on a Blazor server application. There is a requirement to insert excel data (approx. 200000 records) into a table. Is there any tutorial that I can follow? Thank you.

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
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,472 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
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 2023-01-17T17:05:52.67+00:00
Cenk 666 Reputation points
commented 2023-01-18T05:19:03.7466667+00:00
Cenk 666 Reputation points
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