我只是想创建一个可以使用两个模型的控制器.评论模型:
public class Comment
{
public int ID { get; set; } // property
public int PostID { get; set; }
public String Title { get; set; }
public String Name { get; set; }
public Uri Url { get; set; }
public String Text { get; set; }
public Post Post { get; set; }
}
public class CommentDBContext : DbContext
{
public DbSet<Comment> Comments { get; set; }
public System.Data.Entity.DbSet<BlogShauli.Models.Post> Posts { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
邮政模式: …