From 54a682cdf2c81c4d7c112865a567905ee5b3053b Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 5 Sep 2016 11:53:54 +0200 Subject: [PATCH] Introduces tags in db context --- Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs | 2 -- Yavsc/Model/ApplicationDbContext.cs | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs index 4e210d73..11f18eb8 100644 --- a/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Yavsc/Migrations/ApplicationDbContextModelSnapshot.cs @@ -1,8 +1,6 @@ using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Infrastructure; -using Microsoft.Data.Entity.Metadata; -using Microsoft.Data.Entity.Migrations; using Yavsc.Models; namespace Yavsc.Migrations diff --git a/Yavsc/Model/ApplicationDbContext.cs b/Yavsc/Model/ApplicationDbContext.cs index 59741b79..2ca91bc8 100644 --- a/Yavsc/Model/ApplicationDbContext.cs +++ b/Yavsc/Model/ApplicationDbContext.cs @@ -28,6 +28,7 @@ namespace Yavsc.Models builder.Entity().Property(x=>x.CreationDate).HasDefaultValueSql("LOCALTIMESTAMP"); builder.Entity().Property(x=>x.Posted).HasDefaultValueSql("LOCALTIMESTAMP"); builder.Entity().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP"); + builder.Entity().HasKey(x=>new { x.PostId, x.TagId}); } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) @@ -173,5 +174,9 @@ namespace Yavsc.Models public DbSet ExceptionsSIREN { get; set; } public DbSet Locations { get; set; } + + public DbSet Tags { get; set; } + + public DbSet TagsDomain { get; set; } } }