IDTSComponentMetaData100.GetComponentView 方法

Gets the IDTSComponentView100 interface for a component, which supports transactional edits of the component metadata.

命名空间:  Microsoft.SqlServer.Dts.Pipeline.Wrapper
程序集:  Microsoft.SqlServer.DTSPipelineWrap(在 Microsoft.SqlServer.DTSPipelineWrap.dll 中)

语法

声明
Function GetComponentView As IDTSComponentView100
用法
Dim instance As IDTSComponentMetaData100 
Dim returnValue As IDTSComponentView100 

returnValue = instance.GetComponentView()
IDTSComponentView100 GetComponentView()
IDTSComponentView100^ GetComponentView()
abstract GetComponentView : unit -> IDTSComponentView100
function GetComponentView() : IDTSComponentView100

返回值

类型:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentView100
The IDTSComponentView100 interface of the component.

注释

This method is called to retrieve the IDTSComponentView100 interface of the component. This interface allows transactional modifications to be made to the component metadata. The component metadata modifications are persisted when the Commit method is called, and reverted when the Cancel method is called.

示例

The following code example demonstrates how the GetComponentView method is used.

using System;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace Microsoft.Samples.SqlServer.Dts
{
    public class Class1
    {
        public static void Main(string []args)
        {
            // Create the package.
            Package p = new Package();

            // Add the data flow task.
            MainPipe mp = ((TaskHost)p.Executables.Add("DTS.Pipeline")).InnerObject as MainPipe;

            // Add the OLEDB Source component.
            IDTSComponentMetaData100 mdOleDbSrc = mp.ComponentMetaDataCollection.New();
            mdOleDbSrc.ComponentClassID = "DTSAdapter.OleDbSource";
            mdOleDbSrc.Name = "OLEDB Source";

            IDTSComponentView100 oledbView = mdOleDbSrc.GetComponentView();

            mdOleDbSrc.Name = "The OLEDB Source Component";

            Console.WriteLine(mdOleDbSrc.Name);

            oledbView.Cancel();

            Console.WriteLine(mdOleDbSrc.Name);
        }
    }
}
Imports System 
Imports Microsoft.SqlServer.Dts.Runtime 
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper 
Namespace Microsoft.Samples.SqlServer.Dts 

 Public Class Class1 

   Public Shared Sub Main(ByVal args As String()) 
     Dim p As Package = New Package 
     Dim mp As MainPipe = CType(CType(p.Executables.Add("DTS.Pipeline").InnerObject, TaskHost), MainPipe)
     Dim mdOleDbSrc As IDTSComponentMetaData100 = mp.ComponentMetaDataCollection.New 
     mdOleDbSrc.ComponentClassID = "DTSAdapter.OleDbSource" 
     mdOleDbSrc.Name = "OLEDB Source" 
     Dim oledbView As IDTSComponentView100 = mdOleDbSrc.GetComponentView 
     mdOleDbSrc.Name = "The OLEDB Source Component" 
     Console.WriteLine(mdOleDbSrc.Name) 
     oledbView.Cancel 
     Console.WriteLine(mdOleDbSrc.Name) 
   End Sub 
 End Class 
End Namespace

The following output is generated by the above code example.

The OLEDB Source Component

OLEDB Source

请参阅

参考

IDTSComponentMetaData100 接口

Microsoft.SqlServer.Dts.Pipeline.Wrapper 命名空间