Entity Framework
- 11 ответов
- 0 вопросов
4
Вклад в тег
enable-migrations -ContextTypeName Contex -MigrationsDirectory ContexMigrations
Add-migration -configuration MVC.ContexMigrations.Configuration Initial
Update-database -configuration MVC.ContexMigrations.Configuration
public class Card
{
public int CardId { set; get; }
public Record Record { set; get; }
}
public class Record
{
public int RecordId { set; get; }
}
modelBuilder.Entity<Card>()
.HasRequired(x => x.Record)
.WithRequiredPrincipal()
.WillCascadeOnDelete(false);