Exemplo n.º 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);
        }
Exemplo n.º 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)));
 }
Exemplo n.º 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));
        }