public static IEnumerable<TEntity> ExecuteMethodQuery<TEntity>(
this DbContext dataContext,
MethodInfo methodInfo,
params Object?[] parameters
)
where TEntity : class, new()
<ExtensionAttribute>
Public Shared Function ExecuteMethodQuery(Of TEntity As {Class, New}) (
dataContext As DbContext,
methodInfo As MethodInfo,
ParamArray parameters As Object()
) As IEnumerable(Of TEntity)public:
[ExtensionAttribute]
generic<typename TEntity>
where TEntity : ref class, gcnew()
static IEnumerable<TEntity>^ ExecuteMethodQuery(
DbContext^ dataContext,
MethodInfo^ methodInfo,
... array<Object^>^ parameters
)[<ExtensionAttribute>]
static member ExecuteMethodQuery :
dataContext : DbContext *
methodInfo : MethodInfo *
parameters : Object[] -> IEnumerable<'TEntity> when 'TEntity : not struct, new()The stored procedure name is determined by looking for the MethodStoredProcedureAttribute on the calling data context method. If not specified, the stored procedure name is assumed to be the same as the calling method's name.
If the connection is not in an open state, it is opened temporarily while loading the entities. If change tracking is enabled on the data context, changes to the entities will be tracked. If not or the entity is marked with the NeverTrackAttribute, they will not be tracked.
// Execute a search stored procedure and return its result set
public IEnumerable<spTransactionListResult> spTransactionList(int accountKey,
string? symbol, DateTime fromDate, DateTime toDate, string? txType)
{
return this.ExecuteMethodQuery<spTransactionListResult>(this.GetMethodInfo(),
accountKey, symbol, fromDate, toDate, txType);
}