/// <summary>
        /// Performs the get all operation.
        /// </summary>
        /// <param name="keys">
        /// The keys.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{IOfferRedeemed}"/>.
        /// </returns>
        protected override IEnumerable <IOfferRedeemed> PerformGetAll(params Guid[] keys)
        {
            var dtos = new List <OfferRedeemedDto>();

            if (keys.Any())
            {
                // This is to get around the WhereIn max limit of 2100 parameters and to help with performance of each WhereIn query
                var keyLists = keys.Split(400).ToList();

                // Loop the split keys and get them
                foreach (var keyList in keyLists)
                {
                    dtos.AddRange(Database.Fetch <OfferRedeemedDto>(GetBaseQuery(false).WhereIn <OfferRedeemedDto>(x => x.Key, keyList, SqlSyntax)));
                }
            }
            else
            {
                dtos = Database.Fetch <OfferRedeemedDto>(GetBaseQuery(false));
            }

            var factory = new OfferRedeemedFactory();

            foreach (var dto in dtos)
            {
                yield return(factory.BuildEntity(dto));
            }
        }
        /// <summary>
        /// Performs the get by key operation.
        /// </summary>
        /// <param name="key">
        /// The key.
        /// </param>
        /// <returns>
        /// The <see cref="IOfferRedeemed"/>.
        /// </returns>
        protected override IOfferRedeemed PerformGet(Guid key)
        {
            var sql = GetBaseQuery(false)
                      .Where(GetBaseWhereClause(), new { Key = key });

            var dto = Database.Fetch <OfferRedeemedDto>(sql).FirstOrDefault();

            if (dto == null)
            {
                return(null);
            }

            var factory = new OfferRedeemedFactory();

            return(factory.BuildEntity(dto));
        }
 /// <summary>
 /// Performs the get all operation.
 /// </summary>
 /// <param name="keys">
 /// The keys.
 /// </param>
 /// <returns>
 /// The <see cref="IEnumerable{IOfferRedeemed}"/>.
 /// </returns>
 protected override IEnumerable <IOfferRedeemed> PerformGetAll(params Guid[] keys)
 {
     if (keys.Any())
     {
         foreach (var key in keys)
         {
             yield return(Get(key));
         }
     }
     else
     {
         var factory = new OfferRedeemedFactory();
         var dtos    = Database.Fetch <OfferRedeemedDto>(GetBaseQuery(false));
         foreach (var dto in dtos)
         {
             yield return(factory.BuildEntity(dto));
         }
     }
 }