示例#1
0
        public static void Init(ArticleContext context)
        {
            if (!context.Comments.Any())
            {
                context.Comments.AddRange(

                    new Comment {
                    ParentCommentId = 0,
                    CommentText     = "New comment",
                    Author          = "Yan Pershay",
                    CommentDate     = DateTime.Now
                }
                    );
            }

            context.SaveChanges();
        }
 public CommentRepository(ArticleContext context)
 {
     _context = context;
 }