/// <summary>
        /// Creates a DateTime filter that returns the entity records that were active at the time.
        /// History concept creates a similar filter on the "Entity"_Changes repository, but this filter on the base entity class
        /// can only be created of all properties are selected for history tracking, therefore it is implemented in EntityHistoryAllPropertiesInfo.
        /// </summary>
        private static string FilterImplementationSnippet(EntityHistoryAllPropertiesInfo info)
        {
            return string.Format(
@"        public global::{0}.{1}[] Filter(System.DateTime parameter)
        {{
            var sql = ""SELECT * FROM {2}.{3}(@p0)"";
            var query = _executionContext.EntityFrameworkContext.Database.SqlQuery<{0}.{1}>(sql, parameter);
            return query.ToArray();
        }}

",
            info.EntityHistory.Entity.Module.Name,
            info.EntityHistory.Entity.Name,
            SqlUtility.Identifier(info.EntityHistory.Entity.Module.Name),
            SqlUtility.Identifier(info.EntityHistory.Entity.Name + "_AtTime"));
        }
        /// <summary>
        /// Creates a DateTime filter that returns the entity records that were active at the time.
        /// History concept creates a similar filter on the "Entity"_Changes repository, but this filter on the base entity class
        /// can only be created of all properties are selected for history tracking, therefore it is implemented in EntityHistoryAllPropertiesInfo.
        /// </summary>
        private static string FilterImplementationSnippet(EntityHistoryAllPropertiesInfo info)
        {
            return string.Format(
            @"        public global::{0}.{1}[] Filter(System.DateTime parameter)
            {{
            var sql = ""SELECT * FROM {2}.{3}(:dateTime)"";
            var result = _executionContext.NHibernateSession.CreateSQLQuery(sql)
                .AddEntity(typeof({0}.{1}))
                .SetTimestamp(""dateTime"", parameter)
                .List<{0}.{1}>();
            return result.ToArray();
            }}

            ",
            info.EntityHistory.Entity.Module.Name,
            info.EntityHistory.Entity.Name,
            SqlUtility.Identifier(info.EntityHistory.Entity.Module.Name),
            SqlUtility.Identifier(info.EntityHistory.Entity.Name + "_AtTime"));
        }
 private static string FilterInterfaceSnippet(EntityHistoryAllPropertiesInfo info)
 {
     return "IFilterRepository<System.DateTime, " + info.EntityHistory.Entity.Module.Name + "." + info.EntityHistory.Entity.Name + ">";
 }