Database ExtensionsGet Method Info Method
Get the method information for the calling method in the given data context type for use in a
stored procedure method call.
Definition
Namespace: EWSoftware.EntityFramework
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
The method information for the calling method in the given data context
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
C#
public static MethodInfo GetMethodInfo(
this DbContext dataContext
)VB
<ExtensionAttribute>
Public Shared Function GetMethodInfo (
dataContext As DbContext
) As MethodInfoC++
public:
[ExtensionAttribute]
static MethodInfo^ GetMethodInfo(
DbContext^ dataContext
)F#
[<ExtensionAttribute>]
static member GetMethodInfo :
dataContext : DbContext -> MethodInfo Parameters
- dataContext DbContext
- The data context
Return Value
MethodInfoThe method information for the calling method in the given data context
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type DbContext. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Remarks
When a stored procedure method is called asynchronously, the method information must be
obtained from a stack trace as the call may be inside the compiler generated state machine. This
extension method can be used to obtain the necessary method information whether the stored procedure
method is called synchronously or asynchronously.
Example
C#
[MethodStoredProcedure("spStateCodeAddUpdate")]
public int AddOrUpdateStateCode(string? oldState, string? state, string? stateDesc)
{
return this.ExecuteMethodNonQuery(this.GetMethodInfo(), oldState, state, stateDesc).ReturnValue;
}Exceptions
| InvalidOperationException | This is thrown if the method information cannot be determined. |