/// <summary>
        /// Gets a collection of all <see cref="IShipmentStatus"/>.
        /// </summary>
        /// <param name="keys">
        /// The keys.
        /// </param>
        /// <returns>
        /// The collection of <see cref="IShipmentStatus"/>.
        /// </returns>
        protected override IEnumerable <IShipmentStatus> PerformGetAll(params Guid[] keys)
        {
            var dtos = new List <ShipmentStatusDto>();

            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 <ShipmentStatusDto>(GetBaseQuery(false).WhereIn <ShipmentStatusDto>(x => x.Key, keyList, SqlSyntax)));
                }
            }
            else
            {
                dtos = Database.Fetch <ShipmentStatusDto>(GetBaseQuery(false));
            }

            var factory = new ShipmentStatusFactory();

            foreach (var dto in dtos)
            {
                yield return(factory.BuildEntity(dto));
            }
        }
        /// <summary>
        /// Gets a <see cref="IShipmentStatus"/> by it's key
        /// </summary>
        /// <param name="key">
        /// The key.
        /// </param>
        /// <returns>
        /// The <see cref="IShipmentStatus"/>.
        /// </returns>
        protected override IShipmentStatus PerformGet(Guid key)
        {
            var sql = GetBaseQuery(false)
                      .Where(GetBaseWhereClause(), new { Key = key });

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

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

            var factory = new ShipmentStatusFactory();

            var status = factory.BuildEntity(dto);

            return(status);
        }
 /// <summary>
 /// Gets a collection of all <see cref="IShipmentStatus"/>.
 /// </summary>
 /// <param name="keys">
 /// The keys.
 /// </param>
 /// <returns>
 /// The collection of <see cref="IShipmentStatus"/>.
 /// </returns>
 protected override IEnumerable <IShipmentStatus> PerformGetAll(params Guid[] keys)
 {
     if (keys.Any())
     {
         foreach (var id in keys)
         {
             yield return(Get(id));
         }
     }
     else
     {
         var factory = new ShipmentStatusFactory();
         var dtos    = Database.Fetch <ShipmentStatusDto>(GetBaseQuery(false));
         foreach (var dto in dtos)
         {
             yield return(factory.BuildEntity(dto));
         }
     }
 }