Category "entity-framework"

Error while fetching data using FindAsync in C#

I am getting this error "A second operation started on this context before a previous operation completed. This is usually caused by different threads using

In Entity Framework Core 3.1, what is the best way to dynamically provide table name to a query?

I have seen options for .NET 5, .NET Core 2.0, etc. but none of them seem to work for .NET Core 3.1 What is the best way to provide table name, in a variable, t

How to generate user specific instances of an exam object with unique questions

I'm creating an online examination system where I have an exam with a list of questions and need to generate a unique instance/record for each user taking the e

Audit.Net: Audit Record Not Rolling Back When saving master record throws DbUpdateException

I have been using Audit.EntityFramework.Core v14.6.3 in my .Net Core v2.2 Web API. When I update a table record, it threw dbUpdateException error due to a check

Entity Framework rollback and remove bad migration

I'm using EF 6.0 for my project in C# with manual migrations and updates. I have about 5 migrations on the database, but I realised that the last migration was

LINQ select column that contains some array element

I have a field "details" varchar(MAX) in my table with the detailed description of an item, I need to select the records that contain the keywords passed by the

How to use a database connection string in App.config?

I use EF 6, and if I use a hardcode database connection in the OnConfiguring: protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

How to connect to MySQL server using Entity Framework Core

I am using Visual Studio 2019 community edition. I want to connect to MySQL using Entity Framework core. I do not want to use Entity Framework 6. I am running i

Introducing FOREIGN KEY constraint may cause cycles or multiple cascade paths - why?

I've been wrestling with this for a while and can't quite figure out what's happening. I have a Card entity which contains Sides (usually 2) - and both Cards a

constructor with dbcontextoptions not working, unable to create instance of context

Just created a new dotnet web app and can't quite get to create my database. In my Infrastructure Layer I added a dbcontext : public class SurveyContext : D

is there a better way to add a list of integers containing users id as serialized json string to SQL as one record?

I'm working on a Blazor app that's similar to Facebook groups, I have to make a notification function where users can receive a notification message when someon

Error while introducing foreign key constraint

I'm getting an error while trying to EF database update. I have 2 entities, Flight and City: public class Flight : Entity<Guid> { public Airline Air

Best practice to manage entities values and value changing events

Little introduction: we have a complex entity and overgrown business logic related to it. With various fields that we can change and fields that updates from ex

C# LINQ Filter records in child tables

I have a main table "SALES" and two secondary tables "PRODUCTS" and "SERVICES", I need to select only the records in "SALES" that contain some product or servic

EFS on AWS fargate using Terraform- Can't connected

Good day, I'm having issues connecting to my EFS module from ECS fargate. Everything is built in Terraform. Here are the relevent files: efs.tf resource "aws_ef

Entity Framework Core: one-to-one configuration

I updated the title to be more relevant. I have two objects and wish to use EF Core to map them to a database using code first. I have shortened them a bit for

How to seed data in .NET Core 6 with Entity Framework?

I know how to seed data to a database with old .NET 5.0 in startup.cs file using my Seeder class with a Seed() method creating some initial data. public void Co

.NET/EF Core - simple identity

Is it okay to do the identity without using ASP.NET Core Identity? I ask because registration for me is teaking data from user, hash password and put data with

Why does EF insert the same Guid Ids in different fileds?

I've a Page entity dependent on Investor entity as investor creates a page: public class Page { [Required, DatabaseGenerated(DatabaseGeneratedOption.Identit

Meta description is not showing on google results page - REACTJS

my meta description tag is not showing on google result page as well as favicon. my technology stack consist of - reactjs on frontend & entity framework on