ExecuteForPrepare プロパティを true に設定して実行することのできるメソッドとして、アセンブリ内のメソッドをマークします。
名前空間: Microsoft.AnalysisServices.AdomdServer
アセンブリ: msmgdsrv (msmgdsrv.dll 内)
構文
'宣言
<SuppressMessageAttribute("Microsoft.Design", "CA1018:MarkAttributesWithAttributeUsage")> _
<SuppressMessageAttribute("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")> _
Public NotInheritable Class SafeToPrepareAttribute
Inherits Attribute
[SuppressMessageAttribute("Microsoft.Design", "CA1018:MarkAttributesWithAttributeUsage")]
[SuppressMessageAttribute("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")]
public sealed class SafeToPrepareAttribute : Attribute
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1018:MarkAttributesWithAttributeUsage")]
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1019:DefineAccessorsForAttributeArguments")]
public ref class SafeToPrepareAttribute sealed : public Attribute
/** @attribute SuppressMessageAttribute("Microsoft.Design", "CA1018:MarkAttributesWithAttributeUsage") */
/** @attribute SuppressMessageAttribute("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments") */
public final class SafeToPrepareAttribute extends Attribute
SuppressMessageAttribute("Microsoft.Design", "CA1018:MarkAttributesWithAttributeUsage")
SuppressMessageAttribute("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")
public final class SafeToPrepareAttribute extends Attribute
解説
DataTable を返すユーザー定義関数 (UDF) の場合、実行の準備 (つまり、ExecuteForPrepare プロパティを true に設定して実行) ができるようにする必要があります。UDF による実行の準備とは、具体的には、取得する DataTable の構造を確認し、適切に構築された空の DataTable を返すことをいいます。
継承階層
System.Object
System.Attribute
Microsoft.AnalysisServices.AdomdServer.SafeToPrepareAttribute
使用例
次のコードは、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 (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
SafeToPrepareAttribute Members
Microsoft.AnalysisServices.AdomdServer Namespace