Error: 'Package restore failed rolling back package change for' while running Scaffold-Dbcontext in Entity Framework Core 7.0.14
Hello, I'm working on a project using .NET Core 7 and encountering an issue when running Scaffold-DbContext with Entity Framework 7.0.14. The error message I'm getting is "there was an error running the selected code generator package restore failed…
Maui .Net 8 XCode 15.1 and 15.2 NativeAOT Error in Testflight
Hello, I have an Maui app built with XCode 15.2 and .Net 8. I am using Microsoft.EntityFrameworkCore.Sql V8.0.4 When I install it on my iPad with test flight I get: Model binding is not supported when publishing with NativeAOT. Use a compiled model. I…
How do I find the method calling Entity Framework that led to an exception
I believe this call is coming from the ASP.NET Identity Library. However, it may be coming from my Blazor code. The below is the entire exception written to the log. How do I find out what method (Identity library or my Blazor code) is calling this? …
Learning EF - Error running Scaffold-DbContext
I am learning how to user Entity Framework where the models are built from an existing SQL server. I ran this command in the package manager: Scaffold-DbContext “Server=xxx; database=Contoso; user id = cnnxxxxx; password = xxxx”…
How can we debug with InMemoryDatabase and how can we know exactly the key is duplicate?
How can we debug with InMemoryDatabase Unit test? Also I have question that when I get this error for example "An item with the same key has already been added. Key: 16c568e8-b00d-46b2-ab27-cdb7685839ae" why VS don't point exactly what entity…
An issue implementing migrations in the data layer
Hello I started developing a new c# WPF project. In a solution, I separated the layers as UI and Data. I placed database-related models and configurations in the data layer. Then, I gave the Data project as a reference to the ilse UI project. The problem…
Nuget and The package manager on VS 2022 Community edition cannot find the Microsoft.EntityFrameworkCore
Typing Microsoft.EntityFrameworkCore into the Nuget package manager returns nothing and instead displays the NO package found message. The PM console prints the following error text when NuGet\Install-Package Microsoft.EntityFrameworkCore -Version 8.0.3…
Single transaction, multiple service calls to Entity Framework updating database
Hi all; I have a case with a single database defined by a single Entity Framework DbContext. I have things set up where updating the database is via services. This separates things out nicely and makes it easy to mock the database for the bUnit (Blazor…
How do I create a NetTopologySuite.Polygon from a Atlas.BoundingBox?
Hi all; I need to create a Polygon so that in my Entity Framework query I can do: point.Intersects(polygon) The code to create the point is: var center = new TopologyPoint(longitude, latitude) { SRID = 4326 }; I think the code to create the…
Can I share a List<T> property across multiple queries via a tracking DbContext?
Hi all; Will the following work? And if so, will it provide a significant performance improvement. My AppUser object includes: public class AppUser { public int Id { get; private set; } // lots of other properties public List<Tag>?…
how to fix the error occuring when trying the Update-Database command
when I try the command Update-Database i get the error A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that…
How to update a record with dependency object with Entity Framework Core?
I'm studying Entity Framework Core version 8 using a Blazor project. The scenario is quite basic: I like to create a simple blog. I have an Article object that has 2 ICollection properties: Category and Tags [Table("Articles")] public class…
EF Core Tracking
Most of the articles on EF Core suggest don't enable tracking in EF Core. But if tracking is disabled in EF Core. How to add Audit Logs using EF Core Interceptors? I have tried this but looks like more re work is required for many cases where tracking…
Azure deployment error when trying to install dotnet-ef
I am having trouble deploying my website to Azure due to an error with installing dotnet-ef. I have tried various versions using Nuget and the console, but I'm still unable to upload my app to the cloud. I'm following this tutorial…
Azure publish error install dotnet-ef
I am trying to publish a website to Azure, but I am running into an error: I do not know how to solve it. I tried to install it, but I get more errors: I also tried cmd but still no luck. command prompt At this point I have no idea what to do now. How…
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
Working of HasComputedColumnSql() method in EF Core
I have configured the updatedAt property as shown below. I expected that the updatedAt value of the corresponding row alone will change when inserting or updating. But when tried this it is updating entire column i.e all the rows of the UpdatedAt are…
How can I address Entity Framework context disposal issues within IIS Application Pool on an Azure VM hosting an MVC application?
I am encountering an issue with the automatic disposal of the Entity Framework context within the IIS App Pool on my Azure Virtual Machine that is hosting an MVC application. The problem manifests as errors occurring on nearly all pages after a certain…
Migration problem with immutable complex type entity for Entity Framework Core 8
I am using EF Core 8 in my project. I am trying to use an immutable complex-type entity. Here is my code: [ComplexType] public class Address(string line1, string? line2, string city, string country, string postCode) { [MaxLength(250)] …
How to fix error occurred during the pre-login handshake after upgrading SqlClinet
I upgraded project from .NET 6 to .NET 8, along with the packages. Sql Client is upgraded from 2.1.4 to 5.1.1 version contained in EF Core 8.0.1 package. We are using Azure DB, and there is no error in .NET 6 version with older SqlClinet. I'm aware of…