public BlogPost Build()
 {
     var post = new BlogPost
     {
         Id = _id,
         Title = _title,
         SubTitle = _subTitle,
         Text = _text,
         PublicationDate = _publicationDate,
         AuthorName = _authorName
     };
     if (_comments!= null)
         foreach (var comment in _comments)
         {
             post.AddCommant(comment);
         }
     return post;
 }
Пример #2
0
 public void Init()
 {
     _unitOfWork = new UnitOfWork(_sessionFactory);
     _repository = new Repository<int, BlogPost>(_unitOfWork.Session);
     _post = new BlogPostBuilder()
                 .Title("Repository Pattern")
                 .SubTitle("agilefreak.workpress.com")
                 .Text("Unit of work and repository pattern rocks")
                 .PublicationDate(DateTime.Now)
                 .AuthorName("Naz Ali")
                 .Build();
 }
 public CommentBuilder BlogPost(BlogPost blogPost)
 {
     _blogPost= blogPost;
     return this;
 }