Infrastucture does not exist in System.Data.Entity

asp.net-mvc c# entity-framework

Question

I am trying to create MVC project with Entity Framework. I have 3 Projects in Solution

  • SerialTracker.Common
  • SerialTracker.Model
  • SerialTracker.Web

Common and Model are compiled like library, so Web is using them. Model is also using Common.

My probelm is here:

Model generate from *.edmx ==> *.Context.tt ==> whitch auto generates *.Context.cs:

namespace SerialTracker.Model
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Infrastructure;

    public partial class SerialTrackerEntities : DbContext
    {
        public SerialTrackerEntities()
            : base("name=SerialTrackerEntities")
        {
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }

        public DbSet<Role> Role { get; set; }
        public DbSet<User> User { get; set; }
    }
}

I have error, that Infrastucture does not exist in System.Data.Entity. I tried adding some References, but i think the problem is in another place.

//EDIT: I reinstaled NuGet package for this project, but now i have error and doesn't exist

Sorry for my poor English.

1
2
12/20/2012 10:21:53 AM

Accepted Answer

S̶o̶ ̶I̶ ̶m̶a̶n̶u̶a̶l̶y̶ ̶a̶d̶d̶e̶d̶ ̶f̶i̶l̶e̶ ̶S̶e̶r̶i̶a̶l̶T̶r̶a̶c̶k̶e̶r̶.̶t̶t̶ ̶t̶o̶ ̶S̶e̶r̶i̶a̶l̶T̶r̶a̶c̶k̶e̶r̶.̶e̶d̶m̶x̶.̶
T̶h̶i̶s̶ ̶f̶i̶l̶e̶ ̶I̶ ̶c̶o̶p̶i̶e̶d̶ ̶f̶r̶o̶m̶ ̶a̶n̶o̶t̶h̶e̶r̶ ̶p̶r̶o̶j̶e̶c̶t̶.̶
N̶o̶w̶ ̶i̶s̶ ̶p̶r̶o̶j̶e̶c̶t̶ ̶g̶e̶n̶e̶r̶a̶t̶e̶ ̶e̶n̶t̶i̶t̶i̶e̶s̶ ̶R̶i̶g̶h̶t̶.̶

EDIT (04-29-2014):
Renewed answer:
You can delete file *.tt and recreate it with
Add -> New Item -> EF 5.x DbContextGenerator (or EF 6.x ...)

0
5/29/2014 5:21:00 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow