Beispiel #1
0
        /// <summary>
        /// Method to get a single <see cref="PictureEntity"/>.
        /// </summary>
        /// <param name="op"><see cref="PictureOptionsSelect"/> filters options for the query.</param>
        /// <returns>An <see cref="PictureEntity"/> or null.</returns>
        public PictureEntity SingleOrNull(PictureOptionsSelect op)
        {
            if (op == null)
            {
                ArgumentNullException e = Exceptions.GetArgumentNull(nameof(op), typeof(PictureOptionsSelect));
                log.Error(e.Output());
                throw e;
            }

            using (Db.Context)
            {
                return(PictureManager.Select(op));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Method to get a single <see cref="PictureEntity"/> asynchronously.
 /// </summary>
 /// <param name="op"><see cref="PictureOptionsSelect"/> filters options for the query.</param>
 /// <returns>An <see cref="PictureEntity"/> or null.</returns>
 public Task <PictureEntity> SingleOrNullAsync(PictureOptionsSelect op)
 => Task.Run(() => SingleOrNull(op));