2017-01-25 5 views
0

は、私が行っている私のモデル構造を移行ファイルを作成し、エンティティフレームワークのコアは

はsudo DOTNETのEFの移行は、3-MyMigration

コマンドを追加しますが、移行で作成されたファイルがない走っていませんフォルダ。ここで

が出力されます。

Project SocioFal (.NETCoreApp,Version=v1.0) will be compiled because project is not safe for incremental compilation. Use --build-profile flag for more information. 
Compiling SocioFal for .NETCoreApp,Version=v1.0 
Bundling with configuration from /home/aymeric/dotnet_projects/sociofal/SocioFal/bundleconfig.json 
Processing wwwroot/css/site.min.css 
Processing wwwroot/js/site.min.js 
Compilation succeeded. 
    0 Warning(s) 
    0 Error(s) 
Time elapsed 00:00:04.0311963 
(The compilation time can be improved. Run "dotnet build --build-profile" for more information) 

そして、冗長なタグ付き:

Project SocioFal (.NETCoreApp,Version=v1.0) will be compiled because project is not safe for incremental compilation. Use --build-profile flag for more information. 
Compiling SocioFal for .NETCoreApp,Version=v1.0 
Bundling with configuration from /home/aymeric/dotnet_projects/sociofal/SocioFal/bundleconfig.json 
Processing wwwroot/css/site.min.css 
Processing wwwroot/js/site.min.js 
Compilation succeeded. 
0 Warning(s) 
0 Error(s) 
Time elapsed 00:00:13.1481501 
(The compilation time can be improved. Run "dotnet build --build-profile" for more information) 
Setting app base path /home/aymeric/dotnet_projects/sociofal/SocioFal/bin/Debug/netcoreapp1.0 
Finding DbContext classes... 
Using context 'ApplicationDbContext'. 

ので、エラー表示がありません。ここで

が使用されるコンテキストです:

public class ApplicationDbContext : IdentityDbContext<ApplicationUser> 
{ 
    public DbSet<GenealogyRelation> GenealogyRelation { get; set; } 

    public DbSet<FalEvent> FalEvent { get; set; } 
    public DbSet<GenealogyFalEvent> GenealogyFalEvent { get; set; } 
    public DbSet<BaptemeFalEvent> BaptemeFalEvent { get; set; } 

    public DbSet<AdoptionFalEvent> AdoptionFalEvent { get; set; } 

    public DbSet<ConfirmationFalEvent> ConfirmationFalEvent { get; set; } 


    public DbSet<GenealogyCityAndFieldFalEvent> GenealogyCityAndFieldFalEvent { get; set; } 


    public DbSet<City> City { get; set; } 
    public DbSet<FalProfile> FalProfile { get; set; } 
    public DbSet<SocialProfile> SocialProfile { get; set; } 

    public DbSet<StudyField> StudyField { get; set; } 
    public DbSet<UserStudyField> UserStudyField { get; set; } 

    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) 
     : base(options) 
    { 
    } 

    protected override void OnModelCreating(ModelBuilder builder) 
    { 
     builder.Entity<GenealogyFalEvent>().ToTable("GenealogyFalEvent"); 
     builder.Entity<BaptemeFalEvent>().ToTable("BaptemeFalEvent"); 
     builder.Entity<ConfirmationFalEvent>().ToTable("ConfirmationFalEvent"); 
     builder.Entity<AdoptionFalEvent>().ToTable("AdoptionFalEvent"); 
     base.OnModelCreating(builder); 
     // Customize the ASP.NET Identity model and override the defaults if needed. 
     // For example, you can rename the ASP.NET Identity table names and more. 
     // Add your customizations after calling base.OnModelCreating(builder); 
     builder.Entity<GenealogyRelation>().HasKey((e) => new {e.ChildID, e.GenealogyFalEventID, e.ParentID}); 
     builder.Entity<UserCity>().HasKey(u => new {u.CityID, u.UserID}); 
     builder.Entity<UserStudyField>().HasKey(u => new {u.StudyFieldID, u.UserID}); 

    } 
} 

はなぜEFコアは、移行ファイルを作成しませんか?

+0

上記のコマンドを-verboseフラグで実行して、その出力をポストできますか? – Smit

+0

"ApplicationDbContext 'というコンテキストを使用した後に出力がありません。"それは、マイグレーションを生成するコードがまだ実行中であることを示している可能性があります(おそらく無限ループに詰まっている可能性があります) – Smit

+0

その後、コマンドラインがブロックされなかったので、私はそれについて考えていませんでした。私はApplicationDbContextコード、 EFコアが私が使用した複合キーでクラッシュするかどうかは分かりません。 – MoriS

答えて

0

実際にモデルに移行が必要ですか?最後の移行以降に変更しなかった場合、efは移行を生成する必要がないかもしれません。

しかし確かに確信しています。

+0

はい、私のモデルのために新しい構造を作成しました。私はdotnet efデータベースを作成しましたが、データベースを再作成するためのファイルは生成しません。 – MoriS

関連する問題