Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Post
- {
- public int Id { get; set; }
- [Column(TypeName = "date")]
- public DateTime? PostedDate { get; set; }
- [Column(TypeName = "text")]
- public string Body { get; set; }
- public int UserId { get; set; }
- public virtual User User { get; set; }
- public Post()
- {
- Comments = new HashSet<PostComment>();
- }
- }
- public class ApplicationUser : IdentityUser
- {
- public int Id { get; set; }
- [Column(TypeName = "date")]
- public DateTime RegistrationDate { get; set; }
- [Column(TypeName = "date")]
- public DateTime LastVisit { get; set; }
- public virtual ICollection<Post> Posts { get; set; }
- public ApplicationUser()
- {
- Users = new HashSet<User>();
- }
- }
- public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
- {
- public ApplicationDbContext()
- : base("DefaultConnection", throwIfV1Schema: false)
- {
- }
- public virtual DbSet<Post> Posts { get; set; }
- public static ApplicationDbContext Create()
- {
- return new ApplicationDbContext();
- }
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- ...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement