blog tags api

This commit is contained in:
Paul Schneider 2017-09-20 13:07:13 +02:00
commit 71c16c1436
4 changed files with 161 additions and 8 deletions

View file

@ -41,7 +41,7 @@ namespace Yavsc.Models
// Add your customizations after calling base.OnModelCreating(builder);
builder.Entity<Relationship.Contact>().HasKey(x => new { x.OwnerId, x.UserId });
builder.Entity<GoogleCloudMobileDeclaration>().Property(x=>x.DeclarationDate).HasDefaultValueSql("LOCALTIMESTAMP");
builder.Entity<PostTag>().HasKey(x=>new { x.PostId, x.TagId});
builder.Entity<BlogTag>().HasKey(x=>new { x.PostId, x.TagId});
builder.Entity<ApplicationUser>().HasMany<Connection>( c=>c.Connections );
builder.Entity<ApplicationUser>().Property(u=>u.Avatar).HasDefaultValue(Constants.DefaultAvatar);
builder.Entity<ApplicationUser>().Property(u=>u.DiskQuota).HasDefaultValue(Constants.DefaultFSQ);
@ -186,7 +186,7 @@ namespace Yavsc.Models
public DbSet<Tag> Tags { get; set; }
public DbSet<PostTag> TagsDomain { get; set; }
public DbSet<BlogTag> TagsDomain { get; set; }
public DbSet<EstimateTemplate> EstimateTemplates { get; set; }
@ -278,5 +278,7 @@ namespace Yavsc.Models
public DbSet<HyperLink> Links { get; set; }
public DbSet<Period> Period { get; set; }
public DbSet<BlogTag> BlogTags { get; set; }
}
}

View file

@ -2,11 +2,14 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Yavsc.Models.Relationship
{
public partial class PostTag
public partial class BlogTag
{
[ForeignKey("PostId")]
public virtual Blog Post { get; set; }
public long PostId { get; set; }
[ForeignKey("TagId")]
public virtual Tag Tag{ get; set; }
public long TagId { get; set; }
}
}