Пример #1
0
 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);
     }
 }
Пример #2
0
 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);
 }