Пример #1
0
 /// <summary>
 /// Creates an object.
 /// </summary>
 /// <param name="resolver">The resolver.</param>
 /// <param name="context">The context.</param>
 /// <returns>The created object.</returns>
 private static object CreateObject(IIoCResolver resolver, CreateObjectContext context)
 {
     object[] parameters = context.ConstructorArguments
                           .Select(type => resolver.Resolve(type))
                           .ToArray();
     return(context.Constructor.Invoke(parameters));
 }
Пример #2
0
 /// <summary>
 /// Resolves an objects.
 /// </summary>
 /// <typeparam name="TObject">The type of the object to resolve.</typeparam>
 /// <returns>The resolved object.</returns>
 public static TObject Resolve <TObject>(this IIoCResolver resolver)
 {
     return((TObject)resolver.Resolve(typeof(TObject)));
 }