Category "entity-framework"

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