Which is better to use, DbContext.Add() or DbSet.Add()?
Hi, If you allow, I would like to ask a question. In CRUD operations, we can add to the database in two ways: DbContext.Add(object) and DbSet.Add(object). Which one is more correct to use? public class Context : DbContext { public DbSet<Category>…
How to filter a query in EF Core using a Value Object (Email value object) and the filter using Contains method?
I'm using C# EF Core version 7. I have a value object called Email which contains a string Value getter property which will hold the email value, and i have entity called Person which have Id and email i have configuered my entity using fluent api as…
My listview is listing only the id instead of 3 items on the table
PLEASE HELP ME I am working on sqlite database , i have the following code in c# maui return (await conn.Table
System.Reflection.TargetInvocationException: "Expression 'dest => dest' must resolve to top-level member" when configuring AutoMapper profile
I'm encountering an exception when trying to configure AutoMapper in my ASP.NET Core application. The exception message is: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->…
Unable to create a DbContext' Error when Using EF Core in .NET 8 ClassLibrary Project
Hello everyone, I've developed a ClassLibrary project using .NET 8 and C#, and I've utilized EF Core 8 in it. I've defined my own models and context within it. However, when I attempt to use the add-migration command, I encounter this error: "Unable…
How do I store a negative TimeSpan in Entity Framework?
Hi all; I store shifts to events with a TimeSpan as the offset from the start of the event and another TimeSpan as the duration of the shift. The setup shift starts before the event (so everyone see the event as 11:00am - 4:00pm as desired while the…
EF Core 3.1 - System.InvalidOperationException: 'The entity type 'Pntbec03' requires a primary key to be defined. If you intended to use a keyless entity type call 'HasNoKey()'.'
Hello . I need to handle a EF Core Entity relating to a table , but without having EF managing all its columns , but just a subset of them. I have scaffolded the small database to which the table belongs into a DbContext , and I though I could create…
How to retrieve the any table from SQL DB and display dynamically in one page in asp.net core
Requirements are as below. 1. In single page of asp.net core, need to display any table data dynamically like jtable from jQuery plugin... With generic code with ado.net or web api orAPI or entity framework core
Is it correct to make connection string dynamic?
Hi, I'm currently working on a project which need data from other databases. The database where I'll get the datas are depends on users. Now I want to make my connectionString dynamic. Is it correct to make connection strnig dynamic. The user will enter…
how to solve:An unhandled exception occurred while processing the request. SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Doctors_Users_UserId".
An unhandled exception occurred while processing the request. SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Doctors_Users_UserId". The conflict occurred in database "Diabetes2AppDb", table…
probleme mise a jour windows server 2019
bonjour, j'ai un probleme de mise a jour sous Windows Server 2019 mon serveur de domaine apres l'installation des mise a jour , j'ai recu deux messages d'erreurs j'ai besoin de votre aide svp 1- 2023-09 Mise à jour cumulative pour .NET Framework 3.5,…
EF Core doesn't recognize many-to-many relationship
I have a many-to-many relationship, altough EF Core seems not to recognize it. The relationship exists between JobOffer and JobOfferTag. JobOffer inherits from BaseJobOffer. BaseJobOffer.cs public class BaseJobOffer { [Required] …
framework realated question
what is frame in framework for .net applicatons like .net framework 3.5 and what it indicates for frames
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…
EF is not creating a MigrationsHistory table
Hi all; I've been using Entity Frameworks for some time with my app. And I just noticed, there is no MigrationsHistory table. I looked at the files in core/Migrations and none of them create a MigrationsHistory table. Why is it missing and how do I get…
Invalid Argument while scaffolding DB2 schema EF 3.1
Hello. I am trying to scaffold a DB2 schema using the IBM.EntityFrameworkCore provider (version 3.1.0.300) on an AspNet Core 3.1 web application using EntityFramework Core 3.1. The scaffolding command line is the following : Scaffold-DbContext…
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…
Issues with EF Update Command and Azure Credentials in ASP.NET Core Application
I am encountering errors while attempting to run an Entity Framework (EF) update command (dotnet ef database update) from my ASP.NET Core application. The application is connected to a database hosted on Azure. After executing the EF update command, I am…
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. …