Classe SafeToPrepareAttribute
Marks the methods in the assembly that are safe to run with the ExecuteForPrepare property set to true.
Hiérarchie d'héritage
System.Object
System.Attribute
Microsoft.AnalysisServices.AdomdServer.SafeToPrepareAttribute
Espace de noms : Microsoft.AnalysisServices.AdomdServer
Assembly : msmgdsrv (en msmgdsrv.dll)
Syntaxe
'Déclaration
Public NotInheritable Class SafeToPrepareAttribute _
Inherits Attribute
'Utilisation
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
Le type SafeToPrepareAttribute expose les membres suivants.
Constructeurs
Nom | Description | |
---|---|---|
![]() |
SafeToPrepareAttribute | Initializes a new instance of the SafeToPrepareAttribute class. |
Haut de la page
Propriétés
Nom | Description | |
---|---|---|
![]() |
IsSafeToPrepare | Gets a value that indicates whether the associated method is safe to run with the ExecuteForPrepare property set to true. |
![]() |
TypeId | (hérité de Attribute.) |
Haut de la page
Méthodes
Nom | Description | |
---|---|---|
![]() |
{dtor} | Releases all resources used by the SafeToPrepareAttribute. |
![]() |
Equals | (hérité de Attribute.) |
![]() |
GetHashCode | (hérité de Attribute.) |
![]() |
GetType | (hérité de Object.) |
![]() |
IsDefaultAttribute | (hérité de Attribute.) |
![]() |
Match | (hérité de Attribute.) |
![]() |
ToString | (hérité de Object.) |
Haut de la page
Implémentations d'interfaces explicites
Nom | Description | |
---|---|---|
![]() ![]() |
_Attribute.GetIDsOfNames | (hérité de Attribute.) |
![]() ![]() |
_Attribute.GetTypeInfo | (hérité de Attribute.) |
![]() ![]() |
_Attribute.GetTypeInfoCount | (hérité de Attribute.) |
![]() ![]() |
_Attribute.Invoke | (hérité de Attribute.) |
Haut de la page
Notes
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.
Exemples
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;
}
Sécurité des threads
Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.