Category "entity-framework"

Could not find an implementation of the query pattern for source type 'System.Data.Entity.DbSet'

I'm using Entity Framework for the first time, but it seems not working as expected. I have this code: using System; using System.Collections.Generic; using S

EF code-first can there be multiple entities in DbUpdateConcurrencyException.Entries?

We are using EF 6.x with RefactorThis.GraphDiff; so that a related entity-tree is saved/updated using EF. We have added RowVersion for each table to capture t

Creating a Base Class for all entities in Entity Framework 5 in DB first approach

I have few properties like CreatedDate, ModifiedDate, VersionNo on every table. I need to change/ add values for these properties every time I modify the entity

Where to place business logic layer in relation to data access while providing unit testability by dependency injection?

I am looking for a way to have a separate layer of business logic in a MVC4 app with Entity Framework, without having to inject my (real or fake) database conte

Add new Required Field to one of table with EF Code First Migration

I am using EF Code First Migration. I already have lots of data on production Db and I would like to intorduce a non nullable field. How it could be possible?

EF4 generated CRUD views having problems with the Create due to parent-child table relationship

I am relatively new to .NET, and am building a website with MVC3, EF4, SQL 2008 R2. Also, I haven't found anything on Stack that directly seems to address my i

Get Dictionary value in IQueryable LINQ to Entities query

I have to support multiple languages in production application. There are lot of Entity Framework queries that gets data from database as deferred IQueryable l

ASP.NET Core: Error while Updating Migration (Database first approach)

I have created an application in .NET Core where I am trying with database first approach. I was able to add Migration using "Add-Migration InitialCreate" but

IDbAsyncEnumerable not implemented

I am trying to make a FakeDbContext with a FakeDbSet for unit testing. But I get the following error (see below). I am extending DbSet so normally IDbAsyncEnum

Update Entity from ViewModel in MVC using AutoMapper

I have a Supplier.cs Entity and its ViewModel SupplierVm.cs. I am attempting to update an existing Supplier, but I am getting the Yellow Screen of Death (YSOD)

Construct DbGeography point from Latitude and Longitude doubles?

I want to construct a DbGeography point from latitude and longitude doubles. I know I can convert my doubles to strings and use the DbGeography.FromText method

The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception

I have ASP.Net MVC site. Technology Stack ASP.Net 4.6 C#.Net EF 6 MySQL -Database While I am trying to generate the database using Nuget command:- Enable-Mi

Unable to create an object of type 'MyContext'. For the different patterns supported at design time

I have ConsoleApplication on .NET Core and also i added my DbContext to dependencies, but howewer i have an error: Unable to create an object of type 'MyCon

The type 'Company.Model.User' and the type 'Company.Core.Model.User' both have the same simple name of 'User' and so cannot be used in the same model

I have a base entity class MyCompany.Core.Model.User which is to be used for common properties of a User entity: public class User { public string Username

EF4 code-first: defining object relationships, foreign keys

< RANT_MODE > EF code-first approach is meant to save lots of time but for the time being I've only seen toy examples and spent hours trying to understand

EntityDataSource - how to do WHERE Clause from different table

Hi I am using EF 4 and EntityDataSource in a Page (WebForms). This page contains a DropDownList that display UserName. Data from this DropDownList it is from "

The name 'EntityState' does not exist in the current context

In Entity Framework, this sometimes occurs when the System.data.entity assembly is not added into the Project. But, why I didn't have this error before in other

Unable to create an object of type 'DbContext'

When I try to run dotnet ef migration add Init I get error Unable to create an object of type 'IdentityContext'. I know what caused the problem. I wan

How can I project into the same DTO type twice?

The goal here is to update an IQueryable that projects into a dto so it only includes a subset of the properties that it originally included. The "subset" is be

How can I project into the same DTO type twice?

The goal here is to update an IQueryable that projects into a dto so it only includes a subset of the properties that it originally included. The "subset" is be