/// <summary> /// Execute a new composition operation starting within the specified lifetime /// context, for the specified activator. /// </summary> /// <param name="outermostLifetimeContext">Context in which to begin the operation (the operation can flow /// to the parents of the context if requried).</param> /// <param name="compositionRootActivator">Activator that will drive the operation.</param> /// <returns>The composed object graph.</returns> public static object Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator) { Requires.ArgumentNotNull(outermostLifetimeContext, "outermostLifetimeContext"); Requires.ArgumentNotNull(compositionRootActivator, "compositionRootActivator"); using (var operation = new CompositionOperation()) { var result = compositionRootActivator(outermostLifetimeContext, operation); operation.Complete(); return(result); } }
/// <summary> /// Execute a new composition operation starting within the specified lifetime /// context, for the specified activator. /// </summary> /// <param name="outermostLifetimeContext">Context in which to begin the operation (the operation can flow /// to the parents of the context if requried).</param> /// <param name="compositionRootActivator">Activator that will drive the operation.</param> /// <returns>The composed object graph.</returns> public static object Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator) { Requires.NotNull(outermostLifetimeContext, nameof(outermostLifetimeContext)); Requires.NotNull(compositionRootActivator, nameof(compositionRootActivator)); using (var operation = new CompositionOperation()) { var result = compositionRootActivator(outermostLifetimeContext, operation); operation.Complete(); return result; } }
/// <summary> /// Execute a new composition operation starting within the specified lifetime /// context, for the specified activator. /// </summary> /// <param name="outermostLifetimeContext">Context in which to begin the operation (the operation can flow /// to the parents of the context if required).</param> /// <param name="compositionRootActivator">Activator that will drive the operation.</param> /// <returns>The composed object graph.</returns> public static object Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator) { if (outermostLifetimeContext is null) { throw new ArgumentNullException(nameof(outermostLifetimeContext)); } if (compositionRootActivator is null) { throw new ArgumentNullException(nameof(compositionRootActivator)); } using (var operation = new CompositionOperation()) { var result = compositionRootActivator(outermostLifetimeContext, operation); operation.Complete(); return(result); } }