Skip to content

Instantly share code, notes, and snippets.

@Chriz76
Created July 10, 2021 19:36
Show Gist options
  • Save Chriz76/78c045f6f71bd68b69adef4230ff4cda to your computer and use it in GitHub Desktop.
Save Chriz76/78c045f6f71bd68b69adef4230ff4cda to your computer and use it in GitHub Desktop.
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
namespace PostService.Entities
{
[Index(nameof(PostId), nameof(CategoryId))]
public class Post
{
public int PostId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public Int64 TimeStamp { get; set; }
public int UserId { get; set; }
public User User { get; set; }
[Required]
public string CategoryId { get; set; }
public Category Category { get; set; }
}
public class Category
{
public string CategoryId { get; set; }
public long PostCount { get; set; }
}
public class User
{
public int ID { get; set; }
public string Name { get; set; }
public int Version { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment