コード例 #1
0
ファイル: NodeLoader.cs プロジェクト: alexrster/QX.NodeParty
    private INodeFactoryDescriptor LoadDescriptor(NodeConfigurationData configuration)
    {
      foreach (var loader in _descriptorLoaders)
      {
        try
        {
          Debug.Print("Try load Node factory descriptor using loader of type '{0}'", loader.GetType());
          var descriptor = loader.LoadNodeFactoryDescriptor(configuration);
          if (descriptor != null)
          {
            Debug.Print("Successfully loaded Node factory descriptor of type '{0}'", descriptor.GetType());
            return descriptor;
          }

        }
        catch (Exception e)
        {
          Debug.WriteLine(e.Message);
          return null;
        }
      }

      Debug.Fail("There are no loaders configured that able to load Node factory descriptor using configuration data", configuration.GetValue<string>());
      return null;
    }
 public override INodeFactoryDescriptor LoadNodeFactoryDescriptor(NodeConfigurationData configuration)
 {
   return (INodeFactoryDescriptor)_runtime.CreateObject(configuration.GetValue<string>(AttributeName));
 }