Freigeben über


SafeToPrepareAttribute-Klasse

Marks the methods in the assembly that are safe to run with the ExecuteForPrepare property set to true.

Vererbungshierarchie

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

Namespace:  Microsoft.AnalysisServices.AdomdServer
Assembly:  msmgdsrv (in msmgdsrv.dll)

Syntax

'Declaration
Public NotInheritable Class SafeToPrepareAttribute _
    Inherits Attribute
'Usage
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

Der SafeToPrepareAttribute-Typ macht folgende Elemente verfügbar.

Konstruktoren

  Name Beschreibung
Öffentliche Methode SafeToPrepareAttribute Initializes a new instance of the SafeToPrepareAttribute class.

Zum Anfang

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft IsSafeToPrepare Gets a value that indicates whether the associated method is safe to run with the ExecuteForPrepare property set to true.
Öffentliche Eigenschaft TypeId (Geerbt von Attribute.)

Zum Anfang

Methoden

  Name Beschreibung
Öffentliche Methode {dtor} Releases all resources used by the SafeToPrepareAttribute.
Öffentliche Methode Equals (Geerbt von Attribute.)
Öffentliche Methode GetHashCode (Geerbt von Attribute.)
Öffentliche Methode GetType (Geerbt von Object.)
Öffentliche Methode IsDefaultAttribute (Geerbt von Attribute.)
Öffentliche Methode Match (Geerbt von Attribute.)
Öffentliche Methode ToString (Geerbt von Object.)

Zum Anfang

Explizite Schnittstellenimplementierungen

  Name Beschreibung
Explizite SchnittstellenimplementierungPrivate Methode _Attribute.GetIDsOfNames (Geerbt von Attribute.)
Explizite SchnittstellenimplementierungPrivate Methode _Attribute.GetTypeInfo (Geerbt von Attribute.)
Explizite SchnittstellenimplementierungPrivate Methode _Attribute.GetTypeInfoCount (Geerbt von Attribute.)
Explizite SchnittstellenimplementierungPrivate Methode _Attribute.Invoke (Geerbt von Attribute.)

Zum Anfang

Hinweise

If a user defined function (UDF) returns a DataTable, the UDF should be able to prepare for execution by running with the ExecuteForPrepare property set to true. To prepare for execution, the UDF should determine the structure of the DataTable needed to be returned, and return an empty DataTable that is structured appropriately.

Beispiele

In the following example, a simple UDF creates a DataTable. If the UDF runs with the ExecuteForPrepare property set to true, the UDF returns with an empty version of the DataTable. If the UDF runs with the ExecuteForPrepare property set to false, the UDF continues, populates the DataTable, and returns the populated 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;
}

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic)-Elemente dieses Typs sind Threadsicher. Für Instanzelemente wird die Threadsicherheit nicht gewährleistet.

Siehe auch

Verweis

Microsoft.AnalysisServices.AdomdServer-Namespace