📄 task.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace CustomTask
{
[ DtsTask(
DisplayName = "Custom Task",
Description = "Description of custom task",
IconResource = "CustomTask.TaskIcon.ico" ) ]
public class CustomTask : Task
{
private int _sleepPeriod = 3000;
// TODO: Implement task properties as needed. These properties will appear
// in Properties window when you select your task in the Control Flow.
public int SleepPeriod
{
get { return _sleepPeriod; }
set { _sleepPeriod = value; }
}
public override DTSExecResult Validate(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log)
{
// TODO: Add your validation code here.
return DTSExecResult.Success;
}
public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
{
// TODO: Add your execution code here. The following is an example.
bool fireAgain = false;
componentEvents.FireInformation(1, "", "Sleeping for " + _sleepPeriod.ToString() + " ms", "", 0, ref fireAgain);
System.Threading.Thread.Sleep(_sleepPeriod);
componentEvents.FireInformation(2, "", "Woke up", "", 0, ref fireAgain);
return DTSExecResult.Success;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -