次の方法で共有


SafeToPrepareAttribute クラス

ExecuteForPrepare プロパティを true に設定して実行することのできるメソッドとして、アセンブリ内のメソッドをマークします。

継承階層

System. . :: . .Object
  System. . :: . .Attribute
    Microsoft.AnalysisServices.AdomdServer..::..SafeToPrepareAttribute

名前空間:  Microsoft.AnalysisServices.AdomdServer
アセンブリ:  msmgdsrv (msmgdsrv.dll)

構文

'宣言
Public NotInheritable Class SafeToPrepareAttribute _
    Inherits Attribute
'使用
Dim instance As SafeToPrepareAttribute
public sealed class SafeToPrepareAttribute : Attribute
public ref class SafeToPrepareAttribute sealed : public Attribute
[<SealedAttribute>]
type SafeToPrepareAttribute =  
    class
        inherit Attribute
    end
public final class SafeToPrepareAttribute extends Attribute

SafeToPrepareAttribute 型は、以下のメンバーを公開しています。

コンストラクター

  名前 説明
パブリック メソッド SafeToPrepareAttribute SafeToPrepareAttribute クラスの新しいインスタンスを初期化します。

先頭に戻る

プロパティ

  名前 説明
パブリック プロパティ IsSafeToPrepare 関連付けられたメソッドが、ExecuteForPrepare プロパティを true に設定して実行できるかどうかを示す値を取得します。
パブリック プロパティ TypeId (Attribute から継承されています。)

先頭に戻る

メソッド

  名前 説明
パブリック メソッド {dtor} SafeToPrepareAttribute で使用されるすべてのリソースを解放します。
パブリック メソッド Equals (Attribute から継承されています。)
プロテクト メソッド Finalize (Object から継承されています。)
パブリック メソッド GetHashCode (Attribute から継承されています。)
パブリック メソッド GetType (Object から継承されています。)
パブリック メソッド IsDefaultAttribute (Attribute から継承されています。)
パブリック メソッド Match (Attribute から継承されています。)
プロテクト メソッド MemberwiseClone (Object から継承されています。)
パブリック メソッド ToString (Object から継承されています。)

先頭に戻る

明示的なインターフェイスの実装

  名前 説明
明示的なインターフェイスの実装プライベート メソッド _Attribute. . :: . .GetIDsOfNames (Attribute から継承されています。)
明示的なインターフェイスの実装プライベート メソッド _Attribute. . :: . .GetTypeInfo (Attribute から継承されています。)
明示的なインターフェイスの実装プライベート メソッド _Attribute. . :: . .GetTypeInfoCount (Attribute から継承されています。)
明示的なインターフェイスの実装プライベート メソッド _Attribute. . :: . .Invoke (Attribute から継承されています。)

先頭に戻る

説明

DataTable を返すユーザー定義関数 (UDF) の場合、実行の準備 (つまり、ExecuteForPrepare プロパティを true に設定して実行) ができるようにする必要があります。UDF による実行の準備とは、具体的には、取得する DataTable の構造を確認し、適切に構築された空の DataTable を返すことをいいます。

使用例

次のコードは、DataTable を作成する単純な UDF の例です。この UDF を、ExecuteForPrepare プロパティを true に設定して実行した場合、空のバージョンの DataTable が返されます。ExecuteForPrepare プロパティを false に設定して UDF を実行した場合は、続けて DataTable にデータが取り込まれ、データの挿入された DataTable が返されることになります。

[SafeToPrepare(true)]
public System.Data.DataTable GetPreparedTable()
{
    System.Data.DataTable results = new System.Data.DataTable();
    results.Columns.Add("A", typeof(int));
    results.Columns.Add("B", typeof(string));

    if (Context.ExecuteForPrepare)
    {
        // If preparing, return just the schema with no data
        return results;
    }

    //Otherwise return data
    object[] row = new object[2];
    row[0] = 1;
    row[1] = "A";
    results.Rows.Add(row);

    row[0] = 2;
    row[1] = "B";
    results.Rows.Add(row);

    return results;
}

スレッド セーフ

この型の public static (Visual Basic では Shared) のメンバーはすべて、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。