<commit_before>using NHibernate;

namespace Lix.Commons.Specifications
{
    /// <summary>
    /// Represents a specification for building <see cref="ICriteria"/> instances.
    /// </summary>
    /// <typeparam name="TEntity">The type of the entity to build the specification for.</typeparam>
    public abstract class DefaultNHibernateCriteriaSpecification<TEntity> : INHibernateCriteriaSpecification<TEntity>
    {
        public object Build(object context)
        {
            return this.Build(context as ISession);
        }

        /// <summary>
        /// Builds the specification for the <see cref="ISession"/>.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns>
        /// An object representing the built specification.
        /// </returns>
        public ICriteria Build(ISession context)
        {
            var criteria = context.CreateCriteria(typeof(TEntity));

            return this.Build(criteria);
        }

        /// <summary>
        /// Builds the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns>
        /// An ICriteria representing the built specification.
        /// </returns>
        protected abstract ICriteria Build(ICriteria criteria);
    }
}<commit_msg>Added alias name to default criteria specification based on the name of the type<commit_after>using NHibernate;

namespace Lix.Commons.Specifications
{
    /// <summary>
    /// Represents a specification for building <see cref="ICriteria"/> instances.
    /// </summary>
    /// <typeparam name="TEntity">The type of the entity to build the specification for.</typeparam>
    public abstract class DefaultNHibernateCriteriaSpecification<TEntity> : INHibernateCriteriaSpecification<TEntity>
    {
        public object Build(object context)
        {
            return this.Build(context as ISession);
        }

        /// <summary>
        /// Builds the specification for the <see cref="ISession"/>.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns>
        /// An object representing the built specification.
        /// </returns>
        public ICriteria Build(ISession context)
        {
            var criteria = context.CreateCriteria(typeof(TEntity), typeof(TEntity).Name.ToLower());

            return this.Build(criteria);
        }

        /// <summary>
        /// Builds the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns>
        /// An ICriteria representing the built specification.
        /// </returns>
        protected abstract ICriteria Build(ICriteria criteria);
    }
}
{'fraction_non_alphanumeric': 0.12186249545289196, 'fraction_numerical': 0.0, 'mean_word_length': 2.142857142857143, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '2019842', 'n_tokens_mistral': 698, 'n_tokens_neox': 679, 'n_words': 192}