public static void Unbind(object keyData, string contextName = null) { if (!Contexts.FindContext(contextName, out var context, out var errorMessage) || !KeyFactoryCollection.Create(keyData, out var key, out errorMessage) || !context.Unbind(key, out errorMessage)) { throw new Exception(errorMessage); } }
public static IBinding GetBinding(object keyData, string contextName = null) { if (!Contexts.FindContext(contextName, out var context, out var errorMessage) || !KeyFactoryCollection.Create(keyData, out var key, out errorMessage) || !context.Bind(key, out var binding, out errorMessage)) { throw new Exception(errorMessage); } return(binding); }