7.4. Using .NET Assemblies

The capability to reuse code written in other languages is the hallmark of COM and its successor, .NET. While you can only write SSIS scripts using Visual Basic.NET, you can reuse assemblies created using any .NET language including C#, J#, and even Delphi.

Using assemblies gives you the ability to reuse your existing code. You may have already written code that performs data validation; now you can reuse it in your SSIS package. No sense in rewriting code that is already tested and in use.

To use an assembly in your script, you must reference it. To reference it, in turn, you must put it in a location accessible to SSIS. SSIS can only use assemblies located in the .NET framework installation folder for version 2.0.

To add a reference, you must be in the Visual Studio for Applications environment for editing your script code. Go to the Project menu and select Add Reference. The Add Reference window will appear as shown in Figure 7-17.

Figure 7.17. Figure 7-17

Select the assemblies from the list that you wish to reference and click the Add button. They will be added to the component list. Once you're done, click OK to add the references to your project. Now you can use any objects located in the referenced assemblies just like any other object.

Alternatively, you can add and remove references using the Project Explorer. Expand the References node to ...

Get Professional SQL Server™ 2005 Integration Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.