From 3440427da30426a7f669b504781cf204ee2f3626 Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Fri, 2 Jun 2017 16:31:48 +0200 Subject: [PATCH] modify context --- .../Marketing.API/Infrastructure/MarketingContext.cs | 12 ++++++++---- .../Infrastructure/MarketingContextSeed.cs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs index 798d8d152..af6a75cf1 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContext.cs @@ -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 builder) { - builder.ToTable("Rules"); + builder.ToTable("Rule"); builder.HasKey(r => r.Id); + builder.Property(r => r.Id) + .ForSqlServerUseSequenceHiLo("rule_hilo") + .IsRequired(); + builder.HasDiscriminator("RuleTypeId") .HasValue(1) .HasValue(2) diff --git a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs index 9d2bb0157..5f15a725a 100644 --- a/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs +++ b/src/Services/Marketing/Marketing.API/Infrastructure/MarketingContextSeed.cs @@ -57,7 +57,7 @@ new UserLocationRule { Description = "UserLocationRule2", - LocationId = 1 + LocationId = 3 } } }