自定义管道组件SSIS C#如何显示来自验证功能的错误

时间:2019-05-13 21:45:48

标签: c# ssis pipeline

我使用c#使用用户界面创建了一个自定义数据流转换组件。我创建了两个类,它们从我修改了验证功能的PipelineComponent类继承而来。 并从IDtsComponentUI类继承来创建一个表单。 我想在用户界面中显示来自validate函数的错误消息。 有人可以帮我吗?

public override DTSValidationStatus Validate()
    {
        DTSValidationStatus validationStatus;

        if ((ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager == null ? 0 : 1) == 0)
        {
            bool bCancel;
           ComponentMetaData.FireError(-1071636454, ComponentMetaData.Name, "the connection manager is required","",0,out bCancel);

            validationStatus = DTSValidationStatus.VS_ISBROKEN;
        }

        else validationStatus= DTSValidationStatus.VS_ISVALID;
        return validationStatus;

   }

这是我的用户界面示例

   public OptionSetForm(IDTSComponentMetaData100 metaData, IServiceProvider serviceProvider)
    {
        this.metaData = metaData;

        this.serviceProvider = serviceProvider;
        //    ConfigureControlsFromConnectionManager();
        this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
        this.designTimeInstance = metaData.Instantiate();
        //  this.designTimeInstance.ProvideComponentProperties();
        this.errorCollector = this.serviceProvider.GetService(typeof(IErrorCollectionService)) as IErrorCollectionService;
        this._designerHost = this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost;

        userControlGeneralConfigurationsOptionSet = new UserControlGeneralConfigurationsOptionSet(this.connectionService, this.metaData,this.designTimeInstance);



         userControlMappingOptionSet = new UserControlMappingOptionSet(this.connectionService, this.metaData, this.designTimeInstance,this.userControlGeneralConfigurationsOptionSet);




        InitializeComponent();
    }

0 个答案:

没有答案