modify context

This commit is contained in:
Christian Arenas 2017-06-02 16:31:48 +02:00
parent 5f976e90d4
commit 59b8fed228
2 changed files with 9 additions and 5 deletions

View File

@ -28,9 +28,9 @@
{
builder.ToTable("Campaign");
builder.HasKey(ci => ci.Id);
builder.HasKey(m => m.Id);
builder.Property(ci => ci.Id)
builder.Property(m => m.Id)
.ForSqlServerUseSequenceHiLo("campaign_hilo")
.IsRequired();
@ -52,16 +52,20 @@
builder.HasMany(m => m.Rules)
.WithOne(r => r.Campaign)
.HasForeignKey(m => m.CampaignId)
.HasForeignKey(r => r.CampaignId)
.IsRequired();
}
void ConfigureRules(EntityTypeBuilder<Rule> builder)
{
builder.ToTable("Rules");
builder.ToTable("Rule");
builder.HasKey(r => r.Id);
builder.Property(r => r.Id)
.ForSqlServerUseSequenceHiLo("rule_hilo")
.IsRequired();
builder.HasDiscriminator<int>("RuleTypeId")
.HasValue<UserProfileRule>(1)
.HasValue<PurchaseHistoryRule>(2)

View File

@ -57,7 +57,7 @@
new UserLocationRule
{
Description = "UserLocationRule2",
LocationId = 1
LocationId = 3
}
}
}