/// <summary> /// Calls <see cref="IDbDependencyResolver.GetServices" /> passing the given type argument and using /// null for the name argument. /// </summary> /// <param name="resolver"> The resolver to use. </param> /// <param name="type"> The contract type to resolve. </param> /// <returns> All resolved dependencies, or an <see cref="IEnumerable{Object}"/> if no services are resolved.</returns> public static IEnumerable <object> GetServices(this IDbDependencyResolver resolver, Type type) { Check.NotNull(resolver, "resolver"); Check.NotNull(type, "type"); return(resolver.GetServices(type, null)); }
/// <summary> /// Calls <see cref="M:System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver.GetServices(System.Type,System.Object)" /> passing the generic type of the method and the given /// name as arguments. /// </summary> /// <typeparam name="T"> The contract type to resolve. </typeparam> /// <param name="resolver"> The resolver to use. </param> /// <param name="key"> The key of the dependency to resolve. </param> /// <returns> All resolved dependencies, or an <see cref="T:System.Collections.Generic.IEnumerable`1" /> if no services are resolved.</returns> public static IEnumerable <T> GetServices <T>( this IDbDependencyResolver resolver, object key) { Check.NotNull <IDbDependencyResolver>(resolver, nameof(resolver)); return(resolver.GetServices(typeof(T), key).OfType <T>()); }
/// <summary> /// Calls <see cref="M:System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver.GetServices(System.Type,System.Object)" /> passing the given type argument and using /// null for the name argument. /// </summary> /// <param name="resolver"> The resolver to use. </param> /// <param name="type"> The contract type to resolve. </param> /// <returns> All resolved dependencies, or an <see cref="T:System.Collections.Generic.IEnumerable`1" /> if no services are resolved.</returns> public static IEnumerable <object> GetServices( this IDbDependencyResolver resolver, Type type) { Check.NotNull <IDbDependencyResolver>(resolver, nameof(resolver)); Check.NotNull <Type>(type, nameof(type)); return(resolver.GetServices(type, (object)null)); }
public IEnumerable <object> GetServices(Type type, object key) { var type1 = typeof(Enumerable) .GetMethod("Cast", new[] { typeof(IEnumerable) }) .MakeGenericMethod(type); var searchType = type1.ReturnType; if (!_autofacContainer.IsRegistered(searchType)) { return(_snapshot.GetServices(searchType, key)); } if (key != null) { return((IEnumerable <object>)_autofacContainer.ResolveKeyed(key, searchType)); } return((IEnumerable <object>)_autofacContainer.Resolve(searchType)); }
/// <summary> /// Calls <see cref="IDbDependencyResolver.GetServices" /> passing the generic type of the method as /// the type argument and null for the name argument. /// </summary> /// <typeparam name="T"> The contract type to resolve. </typeparam> /// <param name="resolver"> The resolver to use. </param> /// <returns> All resolved dependencies, or an <see cref="IEnumerable{T}"/> if no services are resolved.</returns> public static IEnumerable <T> GetServices <T>(this IDbDependencyResolver resolver) { Check.NotNull(resolver, "resolver"); return(resolver.GetServices(typeof(T), null).OfType <T>()); }
public IEnumerable <object> GetServices(Type type, object key) { return(_resolvedAllDependencies.GetOrAdd( Tuple.Create(type, key), k => _underlyingResolver.GetServices(type, key))); }
public IEnumerable <object> GetServices(Type type, object key) { return(type == typeof(TService) ? (IEnumerable <object>)_snapshot.GetServices <TService>(key).Select(s => _serviceWrapper(s, key)) : Enumerable.Empty <object>()); }