MetaStoredProcedure
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.
MetaStoredProcedure class specifies a stored procedure that exists in the underlying database. It gives information about: the Name of the procedure, and all In and Out parameters.
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>