Listing comments

The comments list feature could be added to the system by performing the following steps:

  1. Create a repository interface, ICommentRepository.
  2. Create a repository object, CommentRepository.

 

  1. Create a query object interface, IGetCommentsByPostQuery.
  2. Create a concrete query object, GetCommentsByPostQuery.
  3. Configure the CommentRepository injection in the Startup file.
  4. Create a View component, CommentsListViewComponent.
  5. Create a ViewDefault.cshtml, under Shared | Components | CommentsList.
  6. Include the current library in the _ViewImports.cshtml to support the custom tag helper.
  7. Add components using the custom tag helper, <vc:comments>.

The preceding listed implementation is performed and available in the following Git repository commit:

https://goo.gl/HqznNF

The View component rendering of the comments list is displayed in the following screenshot:

The comments list that gets rendered using the View component in the anonymous blog is displayed in the following screenshot:

We have seen the changes required to include Post comments to the system. In the next section, let's focus on how comments are added.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset