public static void UnRegisterFunctionsManager(FunctionsManager functionManager)
 {
     lock (_functionsFactoryByKey)
     {
         int key = GetFunctionsManagerKey(functionManager);
         if (_functionsFactoryByKey.ContainsKey(key))
         {
             functionManager.Dispose();
             _functionsFactoryByKey.Remove(key);
         }
     }
 }
        public static FunctionsManager CreateFunctionsManager(string componentName, string stateMachineName, Uri url)
        {
            var functionsManager = new FunctionsManager(componentName, stateMachineName);

            lock (_functionsFactoryByKey)
            {
                int key = GetFunctionsManagerKey(componentName, stateMachineName);
                if (_functionsFactoryByKey.ContainsKey(key))
                {
                    throw  new FunctionsFactoryException("A function manager is already registered for: " + componentName + "," + stateMachineName);
                }

                functionsManager.InitManager(url);

                _functionsFactoryByKey.Add(key, functionsManager);
            }

            return(functionsManager);
        }
 internal static int GetFunctionsManagerKey(FunctionsManager functionsManager)
 {
     return(GetFunctionsManagerKey(functionsManager.ComponentName, functionsManager.StateMachineName));
 }