736 questions with Entity Framework Core tags

Sort by: Updated
2 answers

How to get current User outside of Controller in another layer

In ASP.NET Core 6, I need to get the current user in service layer This is code: public class ServiceModel { private readonly IHttpContextAccessor accessor; public ServiceModel(IHttpContextAccessor accessor) { this.accessor =…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 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,858 questions
asked 2024-09-18T22:15:23.81+00:00
mostafa ahmed 41 Reputation points
answered 2024-09-19T17:41:23.7666667+00:00
Bruce (SqlWork.com) 64,486 Reputation points
2 answers

how to fix Net Framework 3.5 and 4.5 error 0x80070002

how to fix Net Framework 3.5 and 4.5 error 0x80070002

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
asked 2024-09-10T07:57:41.5033333+00:00
Li, Zhang Leslie 0 Reputation points
edited a comment 2024-09-19T01:54:53.4766667+00:00
Hui Liu-MSFT 48,506 Reputation points Microsoft Vendor
1 answer

Cannot Migrate Database

Hello all, I am having issue updating the migration of my database. I am currently using .NET 9.0. I have modified one of my files to include the following: protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.UpdateData( …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
asked 2024-09-16T16:17:42.4466667+00:00
PocketPixie 1 Reputation point
edited a comment 2024-09-18T16:05:06.05+00:00
PocketPixie 1 Reputation point
2 answers

Using IDENTITY_INSERT with FK_ChildTable_ParentTable?

Hello, Wrapping SaveChanges with ON and OFF works fine with individual tables. But not in case of a parent-child relationship where a foreign key exists. Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert explicit value for identity column…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 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.
13,690 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,858 questions
asked 2024-09-16T22:33:43.8366667+00:00
Joyce 80 Reputation points
answered 2024-09-17T21:20:25.1766667+00:00
Erland Sommarskog 110.4K Reputation points MVP
1 answer

Scaffolding (DB first) does not generate Model class

Hi I tried to generate model class based on existing view. This is the command I used in PMC: Scaffold-DbContext "//connectionstring" Oracle.EntityFrameworkCore -schema //schema -table //table -OutputDir Models It seems like it is working.…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
asked 2024-09-17T03:18:53.1433333+00:00
Jia soon Loo 0 Reputation points
answered 2024-09-17T03:23:36.4366667+00:00
Jia soon Loo 0 Reputation points
1 answer

Can't Remove-Migration because of default ID (but Add-Migration worked fine)

I messed up the seed data, and now when I try the "Remove-Migration" command I get this error. The "Add-Migration" command gave me no problems, however. Is this an error? How can I remove the migration? Unable to create a 'DbContext'…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
asked 2024-09-12T18:36:28.3833333+00:00
E 0 Reputation points
commented 2024-09-13T08:54:11.4933333+00:00
Hongrui Yu-MSFT 1,605 Reputation points Microsoft Vendor
0 answers

How to fix .NET Framework error

keeps saying See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Data.Entity.Core.EntityException: The underlying provider failed on Open.…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
asked 2024-09-12T02:58:40.3433333+00:00
Ryan Reventlow 0 Reputation points
commented 2024-09-12T09:45:48.8933333+00:00
Hongrui Yu-MSFT 1,605 Reputation points Microsoft Vendor
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.
736 questions
asked 2024-04-05T22:58:14.0533333+00:00
Vatai Domonkos 15 Reputation points
commented 2024-08-31T14:06:02.36+00:00
K D 0 Reputation points
2 answers One of the answers was accepted by the question author.

Upload Image to ASP.NET Razor Page

Hello, How to add image upload in asp.net core razor pages to a Create and Edit page that is generated from: Add > New Scaffolded Item > Razor Pages using Entity Framework (KRUD) to save the name of image to database and upload image file to…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 questions
asked 2022-04-10T11:23:01.863+00:00
Yusuf 791 Reputation points
commented 2024-08-28T04:48:17.33+00:00
samantak 0 Reputation points
2 answers

How can I post multiple entries at once, when selecting multiple options from a Multi List Dropdown

Hi All, I have hit a bit of a snag with this. I have a form, which contains a multi select dropdown menu. I want to allow the user to select as many options from the drop down menu and upon pressing submit, each different item selected will be saved into…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 questions
asked 2024-01-10T14:48:48.12+00:00
John Rowan 1 Reputation point
commented 2024-08-28T03:32:30.3766667+00:00
Nkosi Alexander 0 Reputation points
2 answers

Getting an error :Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Tried trouble shooting , verfied DB context class. Reinstalled Vs after troubleshooting and getting answers saying there is a problem with package manager .

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 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.
13,690 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,858 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,478 questions
asked 2023-05-19T13:51:47.28+00:00
Shyamali Mishra 0 Reputation points
commented 2024-08-23T16:23:01.12+00:00
Robert L. Bonham 5 Reputation points
1 answer

Entity Framework Core 8, table with a user-defined data type. UDT

We are migrating a 4.5 large application which uses sql data reader to query the MS SQL database to .NET 8 EF core. The database has at least one user-defined column, code below. There is currently 20 years of data in the database. We are migrating…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 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.
13,690 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,858 questions
asked 2024-08-13T22:25:33.4133333+00:00
Phil Alexander 0 Reputation points
edited a comment 2024-08-23T06:26:00.3766667+00:00
Hui Liu-MSFT 48,506 Reputation points Microsoft Vendor
1 answer

how to include a spatial index in c# EF

This query is not using the spatial index: (@__point_0 sys.geometry)SELECT TOP(1) [t].[Id], [t].[Bus_StopsId], [t].[Point] FROM [TripRef_Stops] AS [t] WHERE [t].[Point].STBuffer(5.0000000000000002E-05).STContains(@__point_0) = CAST(1 AS bit) - it is…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 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,858 questions
asked 2024-08-21T11:02:07.8466667+00:00
Stephen Cameron 0 Reputation points
answered 2024-08-22T09:23:09.54+00:00
Stephen Cameron 0 Reputation points
1 answer

Using Enity Framework 6.1 and initial query VERY slow.

When performing the initial query using EF, it can take up to 9 mins. Though if you rerun it again and again it takes seconds. If I capture the query from the profiler, it always runs in seconds. If I wait about 10 / 15 mins the slow initial process…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
asked 2024-08-07T19:04:09.36+00:00
Gary Paquette 0 Reputation points
commented 2024-08-19T07:23:00.14+00:00
Hongrui Yu-MSFT 1,605 Reputation points Microsoft Vendor
2 answers

Map only the selected columns when using EntityFramework

In my recent Entity Core project I am having database table called "YmPlant" and it has 20+ columns. But for my requirement I just need data only from 3 columns. Also I am not required to do the write operations. Only read from YmlPlant table. …

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 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,858 questions
asked 2022-09-23T17:53:48.407+00:00
Nuwan Wickramanayaka 21 Reputation points
commented 2024-08-13T18:17:09.9733333+00:00
John Viele 0 Reputation points
2 answers

How to Optimize Database Interactions in Entity Framework Core?

I am using Entity Framework Core for database interactions in my .NET application. I am seeking advice on optimizing database queries and transactions for better performance and efficiency. Any tips or best practices would be appreciated.

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
asked 2023-09-23T16:04:26.41+00:00
Kevin Beasley 0 Reputation points
commented 2024-08-05T08:31:08.99+00:00
Nubbi 0 Reputation points
2 answers

.Net Framework > .Net Migration Problem - Incremental upgrade with Entity Framework 6.4.4

Hi, (apologies for the lengthy description) I'm working on setting a roadmap for a phased/incremental upgrade path of a .Net Framework 4.8 solution to .Net 8.0+. The existing solution has a large number of projects with direct project references and has…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,808 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,153 questions
asked 2024-07-19T15:40:33.36+00:00
AndyB 0 Reputation points
answered 2024-07-29T16:20:11.24+00:00
Bruce (SqlWork.com) 64,486 Reputation points
2 answers 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…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 questions
asked 2021-11-01T04:16:37.687+00:00
Uchchay Dugal 21 Reputation points
answered 2024-07-24T21:30:32.9566667+00:00
Hazrat Ali 0 Reputation points
1 answer One of the answers was accepted by the question author.

Invalid UserName in ASP.NET Core 6

I am working on an ASP.NET Core 6 MVC application that uses ASP.NET Core Identity. When I try to create a new user using the UserManager, I get this error: User name ' ' is invalid, can only contain letters or digits Username do not has any…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 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,858 questions
asked 2024-07-22T09:02:47.1366667+00:00
mostafa ahmed 41 Reputation points
accepted 2024-07-23T22:36:34.12+00:00
mostafa ahmed 41 Reputation points
2 answers

Cycling problem

Hi, I have 2 entity which have one to many relation between. Lets name them School and student. When I'm creating School I'm getting cycling problem . I did all the configuration in Configure class but nothing worked. There is a way with [JsonIgnore] but…

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,526 questions
asked 2024-07-16T19:06:27.2733333+00:00
Atilla Rüstəmli 40 Reputation points
edited a comment 2024-07-18T02:36:48.31+00:00
SurferOnWww 2,661 Reputation points