private void CheckForEachLoop(ForEachLoop forEachLoop, TreeNode parent)
        {
            // Check properties of loop itself
            ScanProperties(forEachLoop, parent);

            // Check properties of enumerator, when present
            ForEachEnumeratorHost enumerator = forEachLoop.ForEachEnumerator;

            if (enumerator != null)
            {
                TreeNode enumeratorFolder = AddFolder(enumerator.GetType().Name, parent);
                ScanProperties(enumerator, enumeratorFolder);
            }

            // Check the (output) variable mappings
            TreeNode variableMappings = AddFolder("VariableMappings", parent);

            foreach (ForEachVariableMapping mapping in forEachLoop.VariableMappings)
            {
                string match;
                string value = mapping.VariableName;
                if (!string.IsNullOrEmpty(value) && PropertyMatchEval(value, out match))
                {
                    VariableFoundEventArgs info = new VariableFoundEventArgs();
                    info.Match = match;
                    OnRaiseVariableFound(info);
                    AddNode(variableMappings, mapping.ValueIndex.ToString(), GetImageIndex(IconKeyProperty), mapping, true);
                }
            }
        }
        private static string GetName(ForEachEnumeratorHost host)
        {
            switch (host)
            {
            case ForEachEnumeratorHost.File:
                return("Foreach File Enumerator");

            case ForEachEnumeratorHost.Item:
                return("Foreach Item Enumerator");

            case ForEachEnumeratorHost.ADO:
                return("Foreach ADO Enumerator");

            case ForEachEnumeratorHost.ADONETSchemaRowset:
                return("Foreach ADO.NET Schema Rowset Enumerator");

            case ForEachEnumeratorHost.Variable:
                return("Foreach From Variable Enumerator");

            case ForEachEnumeratorHost.NodeList:
                return("Foreach NodeList Enumerator");

            case ForEachEnumeratorHost.SMO:
                return("Foreach SMO Enumerator");

            case ForEachEnumeratorHost.HDFS:
                return("Foreach HDFS File Enumerator");

            default:
                throw new ArgumentException($"Unexpected foreach enumerator host: {host}");
            }
        }
Ejemplo n.º 3
0
        //Determine if the task has an expression
        private bool HasExpression(Executable executable, System.Collections.Generic.List <string> listConfigPaths, out bool HasConfiguration)
        {
            IDTSPropertiesProvider task = (IDTSPropertiesProvider)executable;
            bool returnValue            = false;

            HasConfiguration = false;


            //check for package configurations separately so you can break out of the expensive expressions search as soon as you find one
            foreach (DtsProperty p in task.Properties)
            {
                string sPackagePath = p.GetPackagePath(task);
                if (listConfigPaths.Contains(sPackagePath))
                {
                    HasConfiguration = true;
                    break;
                }
            }

            if (executable is ForEachLoop)
            {
                ForEachEnumeratorHost forEachEnumerator = ((ForEachLoop)executable).ForEachEnumerator;

                // Check the for each loop has been configured, else it won't have an enumerator yet
                if (forEachEnumerator == null)
                {
                    return(returnValue);
                }


                if (!HasConfiguration)
                {
                    //check for package configurations separately so you can break out of the expensive expressions search as soon as you find one
                    foreach (DtsProperty p in forEachEnumerator.Properties)
                    {
                        string sPackagePath = p.GetPackagePath(forEachEnumerator);
                        if (listConfigPaths.Contains(sPackagePath))
                        {
                            HasConfiguration = true;
                            break;
                        }
                    }
                }
            }

            return(returnValue);
        }
Ejemplo n.º 4
0
 public override void Initialize(ForEachEnumeratorHost FEEHost, IServiceProvider serviceProvider, Connections connections, Variables variables)
 {
     _userEnumerator = (ForeachWMI)FEEHost.InnerObject;
     tbDomain.Text   = _userEnumerator.Domain;
 }
 protected ForEachLoopContainerWrapper(ContainerWrapper containerWrapper, ForEachEnumeratorHost host, bool collectionEnumerator, string moniker) : base(containerWrapper, moniker)
 {
     ForEachLoopContainer = Convert.ChangeType(InnerObject, forEachLoopType);
     ForEachLoopContainer.ForEachEnumerator = forEachEnumeratorInfos[GetName(host)].CreateNew();
     ForEachLoopContainer.ForEachEnumerator.CollectionEnumerator = collectionEnumerator;
 }
Ejemplo n.º 6
0
        //Determine if the task has an expression
        private bool HasExpression(Executable executable, System.Collections.Generic.List <string> listConfigPaths, out bool HasConfiguration)
        {
            IDTSPropertiesProvider task = (IDTSPropertiesProvider)executable;
            bool returnValue            = false;

            HasConfiguration = false;

#if !DENALI && !SQL2014 //has built-in expression highlighting
            foreach (DtsProperty p in task.Properties)
            {
                try
                {
                    if (!string.IsNullOrEmpty(task.GetExpression(p.Name)))
                    {
                        returnValue = true;
                        break;
                    }
                }
                catch { }
            }
#endif

            //check for package configurations separately so you can break out of the expensive expressions search as soon as you find one
            foreach (DtsProperty p in task.Properties)
            {
                string sPackagePath = p.GetPackagePath(task);
                if (listConfigPaths.Contains(sPackagePath))
                {
                    HasConfiguration = true;
                    break;
                }
            }

            if (executable is ForEachLoop)
            {
                ForEachEnumeratorHost forEachEnumerator = ((ForEachLoop)executable).ForEachEnumerator;

#if !DENALI && !SQL2014 //has built-in expression highlighting
                if (!returnValue)
                {
                    foreach (DtsProperty p in forEachEnumerator.Properties)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(forEachEnumerator.GetExpression(p.Name)))
                            {
                                returnValue = true;
                                break;
                            }
                        }
                        catch { }
                    }
                }
#endif

                if (!HasConfiguration)
                {
                    //check for package configurations separately so you can break out of the expensive expressions search as soon as you find one
                    foreach (DtsProperty p in forEachEnumerator.Properties)
                    {
                        string sPackagePath = p.GetPackagePath(forEachEnumerator);
                        if (listConfigPaths.Contains(sPackagePath))
                        {
                            HasConfiguration = true;
                            break;
                        }
                    }
                }
            }

            return(returnValue);
        }