Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Created Issue: BufferingReader :: no way to buffer stored procedure calls done via ADO.Net + Translate [990]

$
0
0
One of the ways to execute stored procedure is to use Ado.NET calls to execute reader and then pass this reader into Translate<T> method. However if one uses this approach (rather than relying on the designer), there is not way to take advantage of buffering. We could consider some extra logic in the Translate<T> method to incorporate BufferedReader, unless user opts out of it.

The scenario I mention is as follows:

using (var db = new MyContext())
{
db.Database.Initialize(force: false);

var cmd = db.Database.Connection.CreateCommand();
cmd.CommandText = "[dbo].[MyProc]";

db.Database.Connection.Open();
var reader = cmd.ExecuteReader();

var blogs = ((IObjectContextAdapter)db)
.ObjectContext
.Translate<Blog>(reader, "Blogs", MergeOption.AppendOnly);

foreach (var item in blogs)
{
Console.WriteLine(item.Name);
}
}

Viewing all articles
Browse latest Browse all 10318

Trending Articles