entity-framework-5 Questions

6

Solved

I'm using .NET 4.0, MVC3, and EF5 with code first. My solution is split up into three projects, with the dependencies as indicated: Project.Web -> Project.BLL -> Project.DAL The Project.DAL laye...

4

Solved

I'm mapping up data from an SQL database into an object in c#. The problem is, one of the columns is unfortunately named "100_hrs". So when I am making my C# object, I get an error in the declarati...
Entablature asked 15/4, 2013 at 5:6

7

Solved

I'm trying to create a unit test for my service with a mocked DbContext. I created an interface IDbContext with the following functions: public interface IDbContext : IDisposable { IDbSet<T&gt...
Cristionna asked 21/9, 2014 at 14:24

4

Solved

I am new to EF5 Code First and I'm tinkering with a proof-of-concept before embarking on a project at work. I have initially created a model that looked something like public class Person { publ...

3

Solved

I am using Entity Framework 5 code first. My table has a column called Active and its datatype is of type int. The values that are stored in Active are 0, 1 and null. I have a class that I need to...

9

Solved

I have a controller action that works fine on Firefox both locally and in production, and IE locally, but not IE in production. Here is my controller action: public ActionResult MNPurchase() { Ca...

8

Solved

I have created a migration using the Add-Migration command, but I'd like to change the name of that migration. How can I undo the migration command, so that I can regenerate it using the new desire...

19

Solved

The strange thing is, it was working fine a few days ago. I added a new column to a table and was going to update the model through the designer and now it says "The Entity Data Model Designer is u...
Reliquiae asked 14/2, 2013 at 20:53

10

Solved

I renamed a a couple entities and their navigation properties and generated a new Migration in EF 5. As is usual with renames in EF migrations, by default it was going to drop objects and recreate ...

8

Solved

I am using MVC 4 and entity framework 5.0, i have a database and this database contains 6 tables named as following. tblUser_family tblUser_location tblUser_info tblUser_photo tblUser_settings tbl...

4

Solved

I'm a bit stumped. From what I've read setting the DbContext.AutoDetectChangesEnabled to false should disable change tracking requiring one to call DbContext.DetectChanges in order to identify chan...
Underplot asked 31/5, 2013 at 18:13

28

I am using EF5 beta1 and while I was able to run the "Update-Database" before. Now that I shut down Visual Studio, I cannot get it to run. I get the following error: The term 'Update-Database' i...

12

Solved

I recently upgraded to Visual Studio 2012 RTM Ultimate from MSDN. I'm using EF Code First Migrations to build my database in my app, and I recently added a new entity and want to scaffold the migra...

5

Solved

I know some differences of LINQ to Entities and LINQ to Objects which the first implements IQueryable and the second implements IEnumerable and my question scope is within EF 5. My question is wh...

11

Solved

If I do any changes to my EF 5.0 model, VS does not seem to see the changes. I have tried adding a new table, which shows up fine in the model, but then if I try to use it somewhere the table does ...
Irreformable asked 19/11, 2012 at 19:39

5

Currently working on an ASP.Net MVC 4 application using Entity Framework 5. Used CodeFirst for initial development phase. But have now disabled the Automatic Migrations and designing new tables dir...

9

Solved

I have been exploring different methods of editing/updating a record within Entity Framework 5 in an ASP.NET MVC3 environment, but so far none of them tick all of the boxes I need. I'll explain why...
Requital asked 11/3, 2013 at 10:27

7

Solved

Ok, I have tri-leveled entities with the following hierarchy: Course -> Module -> Chapter Here was the original EF LINQ statement: Course course = db.Courses .Include(i => i.Modules.Select(s ...

28

Solved

I'm working with EF5 in a MVC 4 aspnet website. Locally, everything works just fine, but when I publish it to the IIS and try to enter, I get the error "The type initializer for 'System.Data.Ent...

4

Solved

In Entity Framework 5 model first, there seem to be some breaking changes due to the way the class files are generated (No more code generation, but T4 templates) 2 examples: The generated cont...
Seigniorage asked 20/9, 2012 at 7:39

8

Solved

I am creating asp.net mvc4 sample.In this i created Id column as GUID in Sample table of datacontext. public class Sample { [Required] public Guid ID { get; set; } [Required] public string Fi...

3

Ok, I want to recreate a project that I created using EF 4.1 to EF 5.0, simple enough or at least I thought. One of the things in my old project is that I was able to change the database connection...

8

Solved

ASP.NET MVC 4, EF5, Code First, SQL Server 2012 Express What is best practice to enforce a unique value in a model? I have a places class that has a 'url' property that should be unique for every ...

2

Solved

I have a big database existing database to comunicate with, and I'm using EF 5.0 database first, the problem I'm having is that if I create any data decoration like [stringlength(50)] on the class ...
Josefinejoseito asked 19/7, 2013 at 11:8

2

Solved

How to enable migrations in a class library project? I'm building a project using Code First EF5. I want to separate the data and the mvc web project by adding a class library project. Right now ...

© 2022 - 2025 — McMap. All rights reserved.