Category "entity-framework"

Code first migration error "Implicit conversion from data type nvarchar(max) to varbinary(max) is not allowed"

I changed the data type of a field in my model from string to byte array and I got this error when I run Update-Database code first migration method. Implic

Entity Framework Core error "Column names in each table must be unique"

I have manually added the column IdCategory to my table Books, and now each time I try to run Update-Database, I get this error: fail: Microsoft.EntityFramewor

Enable-Migrations Exception calling "SetData" with "2" argument(s)

I created a library based on .NET 4.6.2 version. To the library, I've added the EntityFramework version 6.1.3 package. I created a model as follow using Syst

Select multiple columns using Entity Framework

Maybe an easy question, but can't find it easily so forgive me =) I try to select multiple columns. The statement I use is: var dataset2 = from recordset in en

Sorting a 1-to-many relationship for a log table for the most recent item

So I have a table, Equipments, that contains assets. There is a table connected to this one in a 1-many relationship that logs each time it is inventoried, by w

How can I use a built Expression in an Include .Where() to apply an Include Filter when it expects Expression but only allows Func?

I'm getting some errors trying to build expression trees on nested collections. I have classes: // not DB entity public FilterTerm { public string Compariso

Unable to create a controller when using asp.net MVC 4/Entity Framework.

I am new to asp.net, and I am now facing a problem. I have created a project using asp.net mvc4, and I have added an entity data model and successfully connect

Displaying an iframe with @Html.Raw is not working like when displaying Script with @Html.Raw

Note: This is written in asp.net mvc 5. That is the tech I am using for this. I am used to displaying certain data when I use @Html.Raw to show data from a Mode

Identity UserManager CreateAsync does not write to database

It doesn't give any errors or warnings but it doesn't insert in the database. Seems like it's only in memory. Also UserManager's FindByNameAsync can't check use

Why is not working EF Core retry on failure

I've configured my db context to retry on failure this way: optionsBuilder.UseSqlServer(connectionString, sqlServerOptionsAction: sqlOptions => {

EntityFramework in test initialization error: CREATE DATABASE statement not allowed within multi-statement transaction

I'm trying to build a quick test that deletes and recreates a database every time it runs. I have the following: [TestClass] public class PocoTest { priva

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