MetaStoredProcedureParameter
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
The MetaStoredProcedureParameter element is a child of the MetaStoredProcedure that specifies parameters for a stored procedure in the database.
The MetaStoredProcedureParameter class exposes the following properties:
- AdoType - the Ado data type for the current parameter. It is used for internal type mapping.
- DeclaringProcedure - the MetaStoredProcedure object that represents the procedure to which the parameter belongs.
- IsNullable - indicates whether the corresponding parameter can accept a null value.
- Length - the length of the parameter.
- Mode - the mode of the parameter - In, Out or InOut.
- Scale - the scale of the parameter.
- SqlType - the server type of the parameter.
The following examples shows you how to get information about the stored procedures in your domain model:
private string GetStoredProcedures(Telerik.OpenAccess.Metadata.MetadataContainer container)
{
StringBuilder sb = new StringBuilder();
foreach (MetaStoredProcedure storedProcedure in container.StoredProcedures)
{
sb.AppendFormat("\nName: {0}", storedProcedure.Name);
sb.AppendLine("Parameters:");
foreach (MetaStoredProcedureParameter parameter in storedProcedure.Parameters)
{
sb.AppendFormat("\tParameterName: {0}", parameter.Name);
sb.AppendFormat("\tType: {0}", parameter.Type);
}
}
return sb.ToString();
}
Private Function GetStoredProcedures(ByVal container As Telerik.OpenAccess.Metadata.MetadataContainer) As String
Dim sb As New StringBuilder()
For Each storedProcedure As MetaStoredProcedure In container.StoredProcedures
sb.AppendFormat(vbLf & "Name: {0}", storedProcedure.Name)
sb.AppendLine("Parameters:")
For Each parameter As MetaStoredProcedureParameter In storedProcedure.Parameters
sb.AppendFormat(vbTab & "ParameterName: {0}", parameter.Name)
sb.AppendFormat(vbTab & "Type: {0}", parameter.Type)
Next parameter
Next storedProcedure
Return sb.ToString()
End Function
The following example shows a sample XML representation of a MetaStoredProcedure element with two MetaStoredProcedureParameter elements:
<orm:procedure name="uspGetBillOfMaterials">
<orm:procedure-parameter name="StartProductID" sql-type="int" length="0" scale="0"
nullable="true"
ado-type="Int32" mode="in"
type="System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]" />
<orm:procedure-parameter name="CheckDate" sql-type="datetime" length="0" scale="0"
nullable="true"
ado-type="DateTime" mode="in"
type="System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]" />
<orm:result-sets />
</orm:procedure>