我是Entity Framework的新手,并且不理解为什么ExecuteReader需要CommandBehavior.SequentialAccess。以下是我的代码..
using (var conn = new EntityConnection("name=EFRecipesEntities"))
{
Console.WriteLine("Customers...");
var cmd = conn.CreateCommand();
conn.Open();
cmd.CommandText = @"select c.Name, C.Email from
EFRecipesEntities.Customers as c";
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{
while (reader.Read())
{
Console.WriteLine("{0}'s email is: {1}",
reader.GetString(0), reader.GetString(1));
}
}
}
任何帮助..
答案 0 :(得分:1)
在EntityDataReader中,有时候Cell(行和列的交集)实际上也拥有另一个Reader。缓存已读过去的嵌套读者有点棘手。所以至少现在我们不支持非顺序访问。