Example #1
0
        /// <summary>
        /// Loads the specified id.
        /// </summary>
        /// <typeparam name="T">Type of result.</typeparam>
        /// <param name="loader">The loader.</param>
        /// <param name="id">The id.</param>
        /// <param name="throwOnNotFound">if set to <c>true</c> [throw on not found].</param>
        /// <returns>Object with specified key</returns>
        public static T Load <T>(this ILoaderWithInclude <T> loader, object id, bool throwOnNotFound)
        {
            T loaded = loader.Load <T>(string.Format(CultureInfo.InvariantCulture, "{0}", id));

            if (throwOnNotFound && loaded == null)
            {
                throw new NotFoundException(typeof(T), id, string.Empty);
            }
            return(loaded);
        }
Example #2
0
 /// <summary>
 /// Loads the specified ids.
 /// </summary>
 /// <param name="ids">The ids.</param>
 public T[] Load(params string[] ids)
 {
     return(_temporal.TemporalLoad(() => _loader.Load <T>(ids)));
 }
Example #3
0
        /// <summary>
        /// Loads the specified ids.
        /// </summary>
        /// <typeparam name="T">Type of result.</typeparam>
        /// <param name="loader">The loader.</param>
        /// <param name="ids">The ids.</param>
        /// <returns>Array of object for specified ids.</returns>
        public static T[] Load <T>(this ILoaderWithInclude <T> loader, IEnumerable <object> ids)
        {
            var idents = ids.Select(id => string.Format(CultureInfo.InvariantCulture, "{0}", id));

            return(loader.Load(idents));
        }