verdie-g/StoredProcedureEFCore

Using Exec ToList() with generic T

Dunsteer opened this issue · 2 comments

I have a problem with executing a stored procedure, It works with a class but does not want to compile with generic type.
Here is my code

List<T> list = null;

_dbContext.LoadStoredProc($"dbo.{procedure_name}")
 .AddParam("max_rv", out IOutParam<byte[]> lastRVFromProcedure)
.Exec(r => list = r.ToList<T>());

And this is the error I get

Error CS1929 'DbDataReader' does not contain a definition for 'ToList' and the best extension method overload 'ParallelEnumerable.ToList(ParallelQuery)' requires a receiver of type 'ParallelQuery'

Edit

How do I use InOut params for the procedure?

Hello, they are two constraints on the T which are class and new(). See DbDataReaderExtension.ToList

Thanks, I figured it out, maybe you should add it to the summery of the ToList extension