Exemplo n.º 1
0
        public void MapOutput(string outputName, string externalColumnName, Lookup.MapType mapType)
        {
            ComponentInstance.InsertOutputColumnAt(
                                              Component.OutputCollection[0].ID,
                                              Component.OutputCollection[0].OutputColumnCollection.Count,
                                              outputName,
                                              outputName);

            string property = (mapType == MapType.JoinToReferenceColumn)
                   ? "JoinToReferenceColumn"
                   : "CopyFromReferenceColumn";

            ComponentInstance.SetOutputColumnProperty(
                                 Component.OutputCollection[0].ID,
                                 Component.OutputCollection[0].OutputColumnCollection[outputName].ID,
                                 property,
                                 externalColumnName
                                 );
        }
Exemplo n.º 2
0
        public static Lookup CreateLookupFromXml(Packages.VulcanPackage vulcanPackage, IDTSComponentMetaData90 parentComponent, MainPipe dataFlowTask, XPathNavigator lookupNav)
        {
            if (lookupNav == null || lookupNav.Name.ToUpperInvariant() != "Lookup".ToUpperInvariant())
            {
                return null;
            }

            string lookupName = lookupNav.SelectSingleNode("@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value;
            Message.Trace(Severity.Debug, "Begin: Lookup Transformation {0}", lookupName);
            Connection sourceConnection =
                Connection.GetExistingConnection(
                                                vulcanPackage,
                                                lookupNav
                                                );

            string query = lookupNav.SelectSingleNode("rc:Query", vulcanPackage.VulcanConfig.NamespaceManager) == null
                ? null
                : lookupNav.SelectSingleNode("rc:Query", vulcanPackage.VulcanConfig.NamespaceManager).Value;

            string table = lookupNav.SelectSingleNode("rc:Table", vulcanPackage.VulcanConfig.NamespaceManager) == null
                ? null
                : lookupNav.SelectSingleNode("rc:Table", vulcanPackage.VulcanConfig.NamespaceManager).Value;

            if (table != null)
            {
                SelectEmitter se = new SelectEmitter(vulcanPackage, table, "*");
                se.Emit(out query);
            }

            Lookup l = new Lookup(vulcanPackage, dataFlowTask, parentComponent, lookupName, lookupName, sourceConnection, query);

            foreach (XPathNavigator inputNav in lookupNav.Select("rc:Input", vulcanPackage.VulcanConfig.NamespaceManager))
            {
                string inputName = inputNav.SelectSingleNode("@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value;
                string joinToName = inputNav.SelectSingleNode("rc:JoinToReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager) == null
                                       ? null
                                       : inputNav.SelectSingleNode("rc:JoinToReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager).Value;

                string copyFromName = inputNav.SelectSingleNode("rc:CopyFromReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager) == null
                                       ? null
                                       : inputNav.SelectSingleNode("rc:CopyFromReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager).Value;

                if (joinToName != null)
                {
                    l.MapInput(inputName, joinToName, Lookup.MapType.JoinToReferenceColumn);
                }
                else if (copyFromName != null)
                {
                    l.MapInput(inputName, copyFromName, Lookup.MapType.CopyFromReferenceColumn);
                }
                else
                {
                    Message.Trace(Severity.Error, "Adding Lookup Type: Must supply either a JoinToName or CopyFromName when mapping inputs.");
                }
            }

            foreach (XPathNavigator outputNav in lookupNav.Select("rc:Output", vulcanPackage.VulcanConfig.NamespaceManager))
            {
                string outputName = outputNav.SelectSingleNode("@Name", vulcanPackage.VulcanConfig.NamespaceManager).Value;
                string joinToName = outputNav.SelectSingleNode("rc:JoinToReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager) == null
                                       ? null
                                       : outputNav.SelectSingleNode("rc:JoinToReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager).Value;

                string copyFromName = outputNav.SelectSingleNode("rc:CopyFromReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager) == null
                                       ? null
                                       : outputNav.SelectSingleNode("rc:CopyFromReferenceColumn", vulcanPackage.VulcanConfig.NamespaceManager).Value;

                if (joinToName != null)
                {
                    l.MapOutput(outputName, joinToName, Lookup.MapType.JoinToReferenceColumn);
                }
                else if (copyFromName != null)
                {
                    l.MapOutput(outputName, copyFromName, Lookup.MapType.CopyFromReferenceColumn);
                }
                else
                {
                    throw new Exception("Vulcan: ETLPattern: Adding Lookup Type: Must supply either a JoinToName or CopyFromName when mapping outputs.");
                }
            }
            return l;
        }
Exemplo n.º 3
0
        public void MapInput(string inputName, string externalColumnName, Lookup.MapType mapType)
        {
            this.SetInputUsageType(inputName, DTSUsageType.UT_READONLY);

            string property = (mapType == MapType.JoinToReferenceColumn)
                               ? "JoinToReferenceColumn"
                               : "CopyFromReferenceColumn";

            ComponentInstance.SetInputColumnProperty(
                                                    Component.InputCollection[0].ID,
                                                    Component.InputCollection[0].InputColumnCollection[inputName].ID,
                                                    property,
                                                    externalColumnName
                                                    );
        }