Browse Source

modify context

pull/223/head
Christian Arenas 7 years ago
parent
commit
59b8fed228
2 changed files with 9 additions and 5 deletions
  1. +8
    -4
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs
  2. +1
    -1
      src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs

+ 8
- 4
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs 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)


+ 1
- 1
src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs View File

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


Loading…
Cancel
Save