<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using Graphite.Core;
using NHibernate.Linq;
using SharpArch.Core.PersistenceSupport.NHibernate;
using SharpArch.Data.NHibernate;

namespace Graphite.Data.Repositories {
  public class PostRepository : NHibernateRepositoryWithTypedId<Post, Guid>, IPostRepository {
    public IEnumerable<Post> GetRecentPosts(int i) { return Session.Linq<Post>().Where(p => p.Published).OrderByDescending(p => p.DatePublished).Take(i); }

    public Post GetWithComments(Guid id) {
      var post = this.Get(id);
      post.Comments.Count();
      return post;
    }
  }

  public class CommentRepository : NHibernateRepositoryWithTypedId<Comment, Guid>, ICommentRepository
  {
    public override Comment Save(Comment entity)
    {
      Session.Save(entity);
      Session.Flush();
      return entity;
    }
  }

  public interface IPostRepository : INHibernateRepositoryWithTypedId<Post, Guid> {
    /// <summary>
    /// Gets the most recent posts in the database
    /// </summary>
    /// <param name="i">Number of recent posts to get</param>
    IEnumerable<Post> GetRecentPosts(int i);

    Post GetWithComments(Guid id);
  }


  public interface ICommentRepository : INHibernateRepositoryWithTypedId<Comment, Guid>
  {
  }
}<commit_msg>Removed unecessary comment repository code<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using Graphite.Core;
using NHibernate.Linq;
using SharpArch.Core.PersistenceSupport.NHibernate;
using SharpArch.Data.NHibernate;

namespace Graphite.Data.Repositories {
  public class PostRepository : NHibernateRepositoryWithTypedId<Post, Guid>, IPostRepository {
    public IEnumerable<Post> GetRecentPosts(int i) { return Session.Linq<Post>().Where(p => p.Published).OrderByDescending(p => p.DatePublished).Take(i); }

    public Post GetWithComments(Guid id) {
      var post = this.Get(id);
      post.Comments.Count();
      return post;
    }
  }

  public class CommentRepository : NHibernateRepositoryWithTypedId<Comment, Guid>, ICommentRepository { }

  public interface IPostRepository : INHibernateRepositoryWithTypedId<Post, Guid> {
    /// <summary>
    /// Gets the most recent posts in the database
    /// </summary>
    /// <param name="i">Number of recent posts to get</param>
    IEnumerable<Post> GetRecentPosts(int i);

    Post GetWithComments(Guid id);
  }


  public interface ICommentRepository : INHibernateRepositoryWithTypedId<Comment, Guid> { }
}
{'fraction_non_alphanumeric': 0.10557768924302789, 'fraction_numerical': 0.0, 'mean_word_length': 4.2531380753138075, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '818322', 'n_tokens_mistral': 768, 'n_tokens_neox': 714, 'n_words': 171}