Skip to content

Instantly share code, notes, and snippets.

@rohits79
Created June 1, 2016 05:27
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/eb7e995e20ee91e1555d42dfe11422b5 to your computer and use it in GitHub Desktop.
Save rohits79/eb7e995e20ee91e1555d42dfe11422b5 to your computer and use it in GitHub Desktop.
Caliburn Static IOC
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