Skip to content

Instantly share code, notes, and snippets.

@rohits79
Created June 1, 2016 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohits79/e4d76201958eaf02fe82035dc7510769 to your computer and use it in GitHub Desktop.
Save rohits79/e4d76201958eaf02fe82035dc7510769 to your computer and use it in GitHub Desktop.
Caliburn static IOC functors
public static class IoC {
/// <summary>
/// Gets an instance by type and key.
/// </summary>
public static Func<Type, string, object> GetInstance = (service, key) => { throw new InvalidOperationException("IoC is not initialized."); };
/// <summary>
/// Gets all instances of a particular type.
/// </summary>
public static Func<Type, IEnumerable<object>> GetAllInstances = service => { throw new InvalidOperationException("IoC is not initialized."); };
/// <summary>
/// Passes an existing instance to the IoC container to enable dependencies to be injected.
/// </summary>
public static Action<object> BuildUp = instance => { throw new InvalidOperationException("IoC is not initialized."); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment