和完成一样:
- 创建 MVC
- 选择Individual User
- 建立 base model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Craglist.Models
{
public class Category : Hideable
{
public virtual ICollection<Subcategory> Subcategories { get; set; }
}
public class Subcategory : Hideable
{
public virtual Category Category { get; set; }
public virtual ICollection<Post> Posts { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Craglist.Models
{
public class Post
{
public int Id { get; set; }
public DateTime Timestamp { get; set; }
public DateTime Expiration { get; set; }
public virtual User Owner { get; set; }
public String Title { get; set; }
public String Body { get; set; }
public virtual Locale Locale { get; set; }
public virtual Subcategory Subcategory { get; set; }
}
}
- PK id
- 发帖 时间
- 过期 时间
- 用户 用户类型
- 发帖 标题
- Body 发帖内容
- 发帖 地点 地点属性
- 发帖 分类 子类型属性
namespace Craglist.Models
{
public class User
{
public String Id { get; set; }
public String Email { get; set; }
public Boolean IsAdmin { get; set; }
}
}
- 用户 ID String
- 用户 邮箱 String
- 用户 管理员属性 Boolean
namespace Craglist.Models
{
public class Category : Hideable
{
public virtual ICollection<Subcategory> Subcategories { get; set; }
}
public class Subcategory : Hideable
{
public virtual Category Category { get; set; }
public virtual ICollection<Post> Posts { get; set; }
}
}
网友评论