내가했던 나의 모델 구조를 마이그레이션 파일을 작성하고엔티티 프레임 워크의 핵심은
sudo는 후에 .NET 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 코어 마이그레이션 파일을 생성하지 않는 이유는 무엇입니까?
위의 명령을 -verbose 플래그와 함께 실행하고 해당 출력을 게시 해 볼 수 있습니까? – Smit
"ApplicationDbContext '컨텍스트를 사용하여 출력이 없습니다." 그 코드는 마이 그 레이션을 생성하는 코드가 아직 실행 중입니다 (아마도 무한 루프에 갇혀) – Smit
그 이후에 명령 줄이 차단되지 않았기 때문에 나는 그것에 대해 생각하지 않았다, 나는 당신이 ApplicationDbContext 코드를 볼 수 있도록 내 질문을 편집했다. EF 코어가 내가 사용한 복합 키에 충돌이 발생하는지 모르시겠습니까? – MoriS