Skip to content

Commit 3440427

Browse files
committed
modify context
1 parent c132d94 commit 3440427

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ void ConfigureCampaigns(EntityTypeBuilder<Campaign> builder)
2828
{
2929
builder.ToTable("Campaign");
3030

31-
builder.HasKey(ci => ci.Id);
31+
builder.HasKey(m => m.Id);
3232

33-
builder.Property(ci => ci.Id)
33+
builder.Property(m => m.Id)
3434
.ForSqlServerUseSequenceHiLo("campaign_hilo")
3535
.IsRequired();
3636

@@ -52,16 +52,20 @@ void ConfigureCampaigns(EntityTypeBuilder<Campaign> builder)
5252

5353
builder.HasMany(m => m.Rules)
5454
.WithOne(r => r.Campaign)
55-
.HasForeignKey(m => m.CampaignId)
55+
.HasForeignKey(r => r.CampaignId)
5656
.IsRequired();
5757
}
5858

5959
void ConfigureRules(EntityTypeBuilder<Rule> builder)
6060
{
61-
builder.ToTable("Rules");
61+
builder.ToTable("Rule");
6262

6363
builder.HasKey(r => r.Id);
6464

65+
builder.Property(r => r.Id)
66+
.ForSqlServerUseSequenceHiLo("rule_hilo")
67+
.IsRequired();
68+
6569
builder.HasDiscriminator<int>("RuleTypeId")
6670
.HasValue<UserProfileRule>(1)
6771
.HasValue<PurchaseHistoryRule>(2)

src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static List<Campaign> GetPreconfiguredMarketings()
5757
new UserLocationRule
5858
{
5959
Description = "UserLocationRule2",
60-
LocationId = 1
60+
LocationId = 3
6161
}
6262
}
6363
}

0 commit comments

Comments
 (0)