0

I have a project that runs some code on SSIS in SqlServer 2005 and SqlServer 2008. My problem is that i maintain two Visual Studio solutions for this, because the data types for the two versions of the SQL Server are different (ends with ..90 on SQL Server 2005 and ...10 on SQL Server 2008). They are in different assemblies also.

Is there an easy way to manage this, both in development and in build, i hate having to enter my code in two places (each solution) and with SQL Server 2011 coming i suspect that i will have to do it three times. How do you solve this, or any advice on how to solve this in general?

Edit: Here is a sample of what I'm doing, as i see it its hard to factor this out in an interface, or?

foreach (IDTSVirtualInputColumn90 virtualColumn in virtualInput.VirtualInputColumnCollection)
{
    if (string.Compare(virtualColumn.Name, columnTransformation.FromColumn.Name, true) == 0 || (columnTransformation.FromColumn.Preformatted && columnTransformation.FromColumn.Name.EndsWith(" as \"" + virtualColumn.Name + "\"")))
    {
       convInstance.SetUsageType(input.ID, virtualInput, virtualColumn.LineageID, DTSUsageType.UT_READONLY);
       IDTSOutputColumn90 outputColumn = convComponent.OutputCollection[0].OutputColumnCollection.New();
       outputColumn.Name = virtualColumn.Name + " (Converted)";
       outputColumn.SetDataTypeProperties(columnTransformation.ToColumn.DataType, columnTransformation.ToColumn.Length, columnTransformation.ToColumn.Precision, columnTransformation.ToColumn.Scale, 0);
       outputColumn.ErrorRowDisposition = DTSRowDisposition.RD_FailComponent;
       outputColumn.TruncationRowDisposition = DTSRowDisposition.RD_IgnoreFailure;
       IDTSCustomProperty90 outputProp = outputColumn.CustomPropertyCollection.New();
       outputProp.Name = "SourceInputColumnLineageID";
       outputProp.Value = virtualColumn.LineageID;
       outputProp = outputColumn.CustomPropertyCollection.New();
       outputProp.Name = "FastParse";
       outputProp.Value = false;
       break;
     }
}

1 Answer 1

1

It's not really clear what your code is doing, but the normal approach to this sort of thing would be to create an interface or abstract class, and then have multiple implementations (or derived classes) for the specialized behaviour. All the common code can just talk to the abstraction, letting the implementation deal with the details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.