SQL Azure中的代码优先迁移 - 不支持没有聚簇索引的表

par*_*ent 5 sql entity-framework azure ef-code-first azure-sql-database

我似乎无法让我的Code-First Migration创建我的SQL Azure数据库.

它一直在抱怨SQL Azure缺乏对没有聚簇索引的表的支持,我无法找到创建数据库的方法.

注意:CreateDatabaseIfNotExists用于在第一次创建数据库时创建更改跟踪表,因为显然DropCreateDatabaseIfModelChanges 不会为您执行此操作

    public partial class IUnityDbContext : DbContext
    {
        public IUnityDbContext()
            : base("Name=IUnityDbContext")
        {
            Database.SetInitializer(new CreateDatabaseIfNotExists<IUnityDbContext>()); 
            //Database.SetInitializer(new DropCreateDatabaseIfModelChanges<IUnityDbContext>());
        }

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

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new UserMap());

            base.OnModelCreating(modelBuilder);
        }
    }




    public partial class Initial : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Users",
                c => new {
                        ... 
                     }
            ).PrimaryKey(u => u.UserId, clustered: true);            
        }

        public override void Down()
        {
            DropTable("dbo.Users");
        }
    }
Run Code Online (Sandbox Code Playgroud)

如果我尝试"更新 - 数据库,我得到

 Tables without a clustered index are not supported in this version of SQL Server. Please create a clustered index and try again.
Run Code Online (Sandbox Code Playgroud)

未创建数据库.

更新:我从头开始并按照本指南启用自动迁移(划伤数据库并以不存在的数据库启动,因此我不必从初始迁移中删除Up/Down代码)

这次我的数据库已成功创建(之前没有这么做),但是没有创建表,我仍然得到与以前相同的错误,不支持没有聚簇索引的表.

请指教

par*_*ent 4

事实证明这是 Entity Framework 6 -Alpha 3 中的一个错误。我想我应该提到这一点。

/sf/answers/1069800301/