/// <summary> /// <para>Create a new generic asyncronous StackWrapper from the <typeparamref name="TEntry"/> /// entry class with the specified delegate to apply as digest.</para> /// <para>If no settings are specified the default ones <seealso cref="StackWrapperSettings.Default"/> will be used.</para> /// examples: /// <code>Injector.AsyncFrom<MyClass>( (e,i,t) => e.Digest(i,t) )</code> /// <code>Injector.AsyncFrom( async (MyClass e, object parameter, CancellationToken token) => e.Digest(parameter, token) )</code> /// tip: you can use tuples to pass multiple arguments if needed<br/> /// </summary> /// <typeparam name="TEntry">class from which start injection</typeparam> /// <typeparam name="TIn">type of elements in input</typeparam> /// <typeparam name="TOut">type of elements in output</typeparam> /// <param name="digest">delegate used to call the relative method to perform on submitted items</param> /// <param name="settings">the settings to use with this object. If null, use default.</param> /// <returns>The created asyncronous wrapper</returns> /// <exception cref="InvalidEntryTypeException"></exception> /// <exception cref="NotAServiceException"></exception> /// <exception cref="ServiceNotFoundException"></exception> /// <exception cref="ImplementationNotFoundException"></exception> /// <exception cref="StackInjectorException"></exception> public static IAsyncStackWrapper <TEntry, TIn, TOut> AsyncFrom <TEntry, TIn, TOut> ( AsyncStackDigest <TEntry, TIn, TOut> digest, StackWrapperSettings settings = null ) { if (settings == null) { settings = StackWrapperSettings.Default; } // create the core and wrap it var core = new InjectionCore(settings) { EntryType = typeof(TEntry) }; var wrapper = new AsyncStackWrapper <TEntry, TIn, TOut>(core) { StackDigest = digest }; // initialize the injection process core.Serve(); return(wrapper); }
/// <summary> /// Builds a new <see cref="IInjectionCore"/> with the specified modules loaded. /// </summary> /// <returns>A new <see cref="IInjectionCore"/> instance.</returns> public IInjectionCore Build() { InjectionCore core = new InjectionCore(); foreach (Assembly assembly in this.assemblies) { core.ScanAssembly(assembly); } foreach (Type module in this.modules) { core.LoadModule(module); } return(core); }
/// <summary> /// <para>Create a new <see cref="IStackWrapper{TEntry}"/> from the entry point <typeparamref name="T"/> </para> /// <para>If no settings are specified the default ones <seealso cref="StackWrapperSettings.Default"/> will be used.</para> /// </summary> /// <typeparam name="T">The type of the entry point</typeparam> /// <param name="settings">settings for this StackWrapper</param> /// <returns>The Initialized StackWrapper</returns> /// <exception cref="InvalidEntryTypeException"></exception> /// <exception cref="NotAServiceException"></exception> /// <exception cref="ServiceNotFoundException"></exception> /// <exception cref="ImplementationNotFoundException"></exception> /// <exception cref="StackInjectorException"></exception> public static IStackWrapper <T> From <T> (StackWrapperSettings settings = null) { if (settings == null) { settings = StackWrapperSettings.Default; } // create the core and wrap it var core = new InjectionCore(settings) { EntryType = typeof(T) }; var wrapper = new StackWrapper <T>(core); // initialize the injection process core.Serve(); return(wrapper); }
public void Setup() { this.core = new InjectionCore(); this.core.LoadModule(typeof(TestModule)); }
internal ClonedCore(InjectionCore clonedCore) { this.clonedCore = clonedCore; }
public AsyncStackWrapper(InjectionCore core) : base(core, typeof(AsyncStackWrapper <TEntry, TIn, TOut>)) { }
internal StackWrapper(InjectionCore core) : base(core, typeof(StackWrapper <TEntry>)) { }