Getting started with writing custom task items (tasks) for SSIs

Source: Internet
Author: User
Tags ssis

In bi studio, many useful task items are provided by default.

But if these tasks do not meet our requirements, can we write one ourselves and add it to the toolbox? The answer is yes.

This topic describes how to get started.

 

1. Create a class library project

Rename the default class1 to myxmltask.

Add Assembly reference: Microsoft. sqlserver. manageddts

2. Compile a simple task item. The function we currently implement for it is: when it is executed, a dialog box pops up, telling us that it is executing

To this end, we add a reference to system. Windows. forms.

Let our types inherit from tasks and rewrite the execute Method for them. Add a dtstask attribute

 

Using system; using system. collections. generic; using system. text; using Microsoft. sqlserver. DTS. runtime; using system. windows. forms; namespace myssistasksample {[dtstask (description = "this is my custom XML task." + "the difference between it and the standard XML task is that it can automatically handle namespace problems ", displayname = "Super XML task", taskcontact = "Chen xizhang: http://www.xizhang.com")] public class myxmltask: task {// <summary> /// this method actually performs the operation /// </Summary> /// <Param name = "Connections"> </param> // /<Param name = "variabledispenser"> </param> // <Param name = "componentevents"> </param> // <Param name = "log"> </param> /// <Param name = "transaction"> </param> // <returns> </returns> Public override dtsexecresult execute (connections, variabledispenser, idtscomponentevents componentevents, idtslogging log, Object Transaction) {MessageBox. show ("I am working"); Return base. execute (connections, variabledispenser, componentevents, log, transaction );}}}

3. Deploy this task item

Please strictly follow the instructions in this article to operate http://msdn.microsoft.com/zh-cn/library/ms403356.aspx

First, generate a strong name signature for it.

Then, generate the project and copy the DLL to the following directory:

At the same time, we also need to add it to GAC

4. Add the task in Bi Studio

Add a tab: "Custom"

In the blank area of "Custom", right-click and select item"

Switch to the "SSIS control items" Page and select "Super XML task"

Click "OK"

5. Test the task.

Create a new package to test the task.

Execute this task

So far, the custom task we have written can work, of course, its current work has almost no significance. However, this article mainly introduces the development and deployment processes. Next, we will introduce how to add a custom editing page.

Author: Chen xizhang at 16:02:05
Released in: http://www.cnblogs.com/chenxizhang/
This article is copyrighted by the author and can be reproduced. However, this statement must be retained without the author's consent, and the original article is clearly connected on the article page. Otherwise, the legal liability will be retained.
For more blog articles, as well as the author's complete comments on Blog references and the policy of cooperation, please refer to the following site: Chen xizhang's blog Center

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.