Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="connection"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public IEnumerable <UserHistoryEntity> Get(UserHistoryEntity entity, DbConnection connection, DbTransaction transaction)
        {
            var reader = default(DbDataReader);

            try
            {
                reader = UserHistoriesGateway.Select(entity, connection, transaction);

                var entities = KandaDbDataMapper.MapToEnumerable <UserHistoryEntity>(reader);

                return(entities);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="criteria"></param>
        /// <param name="connection"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public UserHistoryEntity Find(UserHistoriesCriteria criteria, DbConnection connection, DbTransaction transaction)
        {
            var reader = default(KandaDbDataReader);

            try
            {
                reader = UserHistoriesGateway.Select(criteria, connection, transaction);

                var found = reader.Read() ? KandaDbDataMapper.MapToObject <UserHistoryEntity>(reader) : UserHistoryEntity.Empty;

                return(found);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }