Blazor Server: It is possible get Current Loged User In DbContext
Hello, I build blazor server multi tenant application and I wants to use HasQueryFilter in entity framework DbContext for predefined filter with TenantId. But I cannot get Current Loged User in DbContext. I inject to DB Context…
saving the Identity token in the Aspnetusertokens table
Hi I created an Asp.net core 6 project and I added the Identity framework for authentication and authorization, I would like to add token management and while doing research I realized that Identity also manages the management of tokens because it…
Microsoft.EntityFrameworkCore.SQLServer 8.0.1 (latest version) has High vulnerabilities on its transitive dependencies. When will we have another patch released with no vulnerabilities on its transitive dependencies?
Microsoft.EntityFrameworkCore.SQLServer 8.0.1 (latest version) has High vulnerabilities due to transitive dependencies on Azure.Identity 1.7.0 and Microsoft.Data.SQLClient5.1.1. Both these dependent packages have a non vulnerable latest version. …
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 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…
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…
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 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…