From d623a7f1e7fa8813985575194b9eae2471c6385c Mon Sep 17 00:00:00 2001 From: shept Date: Wed, 16 Apr 2025 20:57:39 +0500 Subject: [PATCH] idk some fix to connect DbContexts --- SurveyLib.Infrastructure.EFCore/Data/SurveyDbContext.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SurveyLib.Infrastructure.EFCore/Data/SurveyDbContext.cs b/SurveyLib.Infrastructure.EFCore/Data/SurveyDbContext.cs index d77fb6d..f505684 100644 --- a/SurveyLib.Infrastructure.EFCore/Data/SurveyDbContext.cs +++ b/SurveyLib.Infrastructure.EFCore/Data/SurveyDbContext.cs @@ -16,7 +16,12 @@ public class SurveyDbContext : DbContext public DbSet Completions { get; set; } public DbSet Answers { get; set; } - public SurveyDbContext(DbContextOptions options) : base(options) + public SurveyDbContext(DbContextOptions options) : base(options) { } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity().HasKey(a => new { a.CompletionId, a.QuestionId }); + } } \ No newline at end of file