Use a custom DLL file in SSIS

Source: Internet
Author: User
Tags ssis
Procedure
1. Develop the dll (signature required) using System;
Using System. Collections. Generic;
Using System. Text;
Using System. Xml;
Using System. Xml. Schema;


Namespace ETLXmlParser
{
Public class ETLXmlParser
{
Private static bool isValid = true;

Public static bool Validate (string XmlFilepath, string XsdFilePath)
{
Try {
XmlReader reader;
XmlReaderSettings settings = new XmlReaderSettings ();
XmlSchemaSet schemaSet = new XmlSchemaSet ();
SchemaSet. Add (null, XsdFilePath );
Settings. Schemas. Add (schemaSet );
Settings. ValidationType = ValidationType. Schema;

Settings. ValidationEventHandler + = new ValidationEventHandler (settings_ValidationEventHandler );
Settings. ValidationFlags = rule. ReportValidationWarnings | rule. ProcessInlineSchema | rule. AllowXmlAttributes | XmlSchemaValidationFlags. ProcessIdentityConstraints | rule. ProcessSchemaLocation;
Reader = XmlReader. Create (XmlFilepath, settings );
While (reader. Read ())
{
String xmlFile = reader. Value;
}
Reader. Close ();
Return isValid;
}
Catch (Exception ex)
{
Return false;
}
}

Private static void settings_ValidationEventHandler (object sender, ValidationEventArgs e)
{

IsValid = false;
}
}
}

2. Copy the compiled dll to C: \ Program Files \ Microsoft SQL Server \ 90 \ DTS \ PipelineComponents (SQL Server Installation Directory) and C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727
3. Drag the DLL to the C: \ WINDOWS \ assemblyfolder, or use the command to install the dll(gacutil.exe/I myassembly. dll)
4. Drag a Script Task into SSIS, design the Script, and add the application dll

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.