Пример #1
0
        /// <summary>
        /// Get pictures hashes
        /// </summary>
        /// <param name="picturesIds">Pictures Ids</param>
        /// <returns></returns>
        public IDictionary <int, string> GetPicturesHash(int[] picturesIds)
        {
            if (!picturesIds.Any())
            {
                return(new Dictionary <int, string>());
            }

            var hashes = _dataProvider.GetTable <PictureBinary>()
                         .Where(p => picturesIds.Contains(p.PictureId))
                         .Select(x => new
            {
                x.PictureId,
                Hash = Hash(x.BinaryData, _dataProvider.SupportedLengthOfBinaryHash)
            });

            return(hashes.ToDictionary(p => p.PictureId, p => p.Hash));
        }
Пример #2
0
 /// <summary>
 /// Loads the original copy of the entity
 /// </summary>
 /// <typeparam name="TEntity">Entity type</typeparam>
 /// <param name="entity">Entity</param>
 /// <returns>Copy of the passed entity</returns>
 public virtual TEntity LoadOriginalCopy(TEntity entity)
 {
     return(_dataProvider.GetTable <TEntity>()
            .FirstOrDefault(e => e.Id == Convert.ToInt32(entity.Id)));
 }