使用CodeFirst .net应用程序生成实体

时间:2015-10-27 20:40:57

标签: .net asp.net-mvc visual-studio entity-framework-6

我正在尝试使用“CODE FIRST”在Visual Studio 2015上生成数据库

我创建了一个包含3个库类的项目。在域库中,我创建了一个名为double serverTime = System.currentTimeMillis() + offset; ref.orderBy('createdAt').startAt(serverTime); 的实体:

Performance

这是我在数据库中的上下文类:

namespace Imdb.Domain.Entities
{
   public class Performance
   { 
       public int PerformanceId { get; set; }
       [DataType(DataType.Date)] //f
       public DateTime Date { get; set; }
       [Range(0, double.MaxValue)] //g
       public Double Price { get; set; }
       [DataType(DataType.DateTime)] //h
       public TimeSpan StrartingTime { get; set; }
       public int NumberReservedSeats { get; set; }
       public Movie Movie { get; set; }
       public int MovieId { get; set; }
       public Theatre Theatre { get; set; }
       public int TheatreId { get; set; }
    }
}

我将public class IMDBContext : DbContext { public IMDBContext() : base("IMDB") { Database.SetInitializer<IMDBContext>(new IMDBContextInitializer()); } public DbSet<Performance> Performances { get; set; } //4 } 添加到数据库中:

app.config

我创建了数据库,测试了连接,没关系。但是当我尝试生成实体时,我在数据库中找不到任何表。

0 个答案:

没有答案