public FactDataFlow(EzContainer parent, PACKAGE_FACT p, SOURCEOBJECT so) : base(parent) { this.p = p; this.so = so; p.m.SOURCEOBJECTS[0]. EzOleDbSource Source = new EzOleDbSource(this); Source.Connection = p.Conns["Source"]; //TODO correct query Source.SqlCommand = String.Format("select * from {0} where ActiveFlag = 'Y' and CreatedDate > '01-01-1900'", so.DATAOBJECT.tableName("PSA")); Source. Source.Name = p.m.NAME; WrapperObject A = new WrapperObject(); A.LastStep = (EzComponent) Source; //TODO for each lookup, write lookup query, output EzLookup Lookup_1 = new EzLookup(this); Lookup_1.AttachTo(A.LastStep); EzRowCount RowsInserted = new EzRowCount(this); RowsInserted.Name = "Rows Inserted"; RowsInserted.VariableName = "Audit::RowsInserted"; RowsInserted.AttachTo(Lookup_1); EzOleDbDestination FactDestination = new EzOleDbDestination(this); FactDestination.Name =this.p.tableName(); FactDestination.AttachTo(RowsInserted); FactDestination.Connection = p.Conns["FACT"]; FactDestination.Table = p.tableName(); FactDestination.LinkAllInputsToOutputs(); FactDestination.ReinitializeMetaData(); }
public DimDataFlow(EzContainer parent, PACKAGE_DIM p, SOURCEOBJECT so) : base(parent) { this.p = p; this.so = so; EzOleDbSource Source = new EzOleDbSource(this); Source.Connection = p.Conns["Source"]; Source.SqlCommand = String.Format("select * from {0} where ActiveFlag = 'Y' and CreatedDate > '01-01-1900'", so.DATAOBJECT.tableName("PSA")); Source.Name = so.DATAOBJECT.tableName("PSA"); EzDerivedColumn DeriveAttributes = new EzDerivedColumn(this); DeriveAttributes.AttachTo(Source); DeriveAttributes.Name = "Derive Attributes"; //TODO for each mapping column add attribute expression foreach (MAPPINGCOLUMN mappingColumn in so.MAPPINGCOLUMNS) { if (mappingColumn.ATTRIBUTE == null) { mappingColumn.ATTRIBUTE = mappingColumn.DATACOLUMN; } //TODO based on attribute type determine what sort of SSIS-ifying the data column needs DeriveAttributes.Expression[mappingColumn.ATTRIBUTE] = "(DT_STR,150,1252)\"" + mappingColumn.DATACOLUMN + "\""; } EzConditionalSplit ActionCode = new EzConditionalSplit(this); ActionCode.AttachTo(DeriveAttributes); ActionCode.Condition["case1"] = "ActionCode == 'UPDATE'"; ActionCode.Condition["case2"] = "ActionCode == 'INSERT'"; EzRowCount RowsMatched = new EzRowCount(this); RowsMatched.Name = "Rows Matched"; RowsMatched.VariableName = "Audit::RowsMatched"; RowsMatched.AttachTo(ActionCode, 0, 0); //TODO correct ole db command query, parameter mapping EzOleDbCommand UpdateDimension = new EzOleDbCommand(this); UpdateDimension.AttachTo(RowsMatched); EzRowCount RowsInserted = new EzRowCount(this); RowsInserted.Name = "Rows Inserted"; RowsInserted.VariableName = "Audit::RowsInserted"; RowsInserted.AttachTo(ActionCode, 1, 0); EzOleDbDestination InsertedDestination = new EzOleDbDestination(this); InsertedDestination.Name =String.Format("{0} - New Records", this.p.tableName()); InsertedDestination.AttachTo(RowsInserted); InsertedDestination.Connection = p.Conns["DIM"]; InsertedDestination.Table = p.tableName(); InsertedDestination.LinkAllInputsToOutputs(); InsertedDestination.ReinitializeMetaData(); }