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 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…
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…
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…
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. …
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.
.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…
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…
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…
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…
How to get license terms for Entity Framework 4.3.0 nuget package and also source code?
Hello, I am not sure if this is right forum for this question. What i need is the license terms from Microsoft for using the Entity Framework 4.3.0 nuget package in the application which is disctributed commercially. Also, since Entity Framework is…
EF Core AUTO_INCREMENT problem with MySQL database
The only problem i have now that i finished my database design is that the AUTO_INCREMENT is not specified when creating the tables by EF Core. This is the modelBuilder modelBuilder.Entity<Conturi>(entity => { …
Entity Framework complains that there is no primary key
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace WpfApp6.Models; public partial class Product [Key] public int IdProduct { get; set; } public string NameOfProduct { get; set; } = null!; public…
Inserting data in many to many relation ship in EF core
i have two tables 1-Employees (ID ,EmpName) 2- Project (ID,ProjectName) data is already inserted in boh tables ,there is many to many relationship between these two so middle table created in table i.e EmployeesProject now i want to insert data (keys of…
Add-Migration works, but Update-Database says "no migrations to update". I tried deleting the Mig.. Folder
Visual Studio and EF Core problem. Migrations don't work. Add-Migration Title works to update the schema, but Update-Database in NuGet Command Console says that the db is already up to date, but the db does not have my new table in it. I tried…
How can I save a collection of CultureInfo type using EF Core without adding backing fields?
In a class, I have a collection of type List<CultureInfo> OfficialLanguages. I need to respect domain driven design for this project. I cannot add a backing field of type List<string> officialLanguagesCodes and handle it that way. When I have…
EF Core - High Memory Usage For Query that Runs for 20 seconds
I'm wondering if there is a better way to optimize the below query. Granted, it's pulling in 80,000 - 160,000 records, but the RAM usage on my web server, shoots up to ~3gig while it's running for a total of 20 seconds, when testing it in my API, but,…
BulkInsert for Entity Framework Core
Entity Framework core now has ExecuteUpdate and ExecuteDelete for doing large updates and deletes But when is EF core going to get the much need BulkInsert that does the job of SQL SERVER's BCP There are third party tools, but they are very expense…
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…