Created
February 17, 2011 22:07
-
-
Save andreasohlund/832837 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Used to instantiate types, so that all configured dependencies | |
| /// and property values are set. | |
| /// An abstraction on top of dependency injection frameworks. | |
| /// </summary> | |
| public interface IBuilder : IDisposable | |
| { | |
| /// <summary> | |
| /// Creates an instance of the given type, injecting it with all defined dependencies. | |
| /// </summary> | |
| /// <param name="typeToBuild"></param> | |
| /// <returns></returns> | |
| object Build(Type typeToBuild); | |
| /// <summary> | |
| /// Creates an instance of a child builder which is used to facilitate deterministic | |
| /// disposal of all resources created by the child builder. | |
| /// </summary> | |
| /// <returns></returns> | |
| IBuilder CreateChildBuilder(); | |
| /// <summary> | |
| /// Creates an instance of the given type, injecting it with all defined dependencies. | |
| /// </summary> | |
| /// <typeparam name="T"></typeparam> | |
| /// <returns></returns> | |
| T Build<T>(); | |
| /// <summary> | |
| /// For each type that is compatible with T, an instance is created with all dependencies injected, and yeilded to the caller. | |
| /// </summary> | |
| /// <typeparam name="T"></typeparam> | |
| /// <returns></returns> | |
| IEnumerable<T> BuildAll<T>(); | |
| /// <summary> | |
| /// For each type that is compatible with the given type, an instance is created with all dependencies injected. | |
| /// </summary> | |
| /// <param name="typeToBuild"></param> | |
| /// <returns></returns> | |
| IEnumerable<object> BuildAll(Type typeToBuild); | |
| /// <summary> | |
| /// Builds an instance of the defined type injecting it with all defined dependencies | |
| /// and invokes the given action on the instance. | |
| /// </summary> | |
| /// <param name="typeToBuild"></param> | |
| /// <param name="action"></param> | |
| void BuildAndDispatch(Type typeToBuild, Action<object> action); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment