LinqToSql如何生成存储过程的输出结果
How LinqToSql Generates output result of stored procedures
例如,您有一个存储过程,标题为:sp_test
当您拖入 LinqToSql 时,它会生成 sp_testResult
class 并将存储过程输出列作为其属性。
我想知道LinqToSql如何区分存储过程的输出结果?
这是 SqlCommandBuilder.GetSchemaTable(...)
中发生的事情,可悲的是 protected
。
SqlCommand command; // setup as SP
using (SqlDataReader reader = command.ExecuteReader(
CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly))
{
return reader.GetSchemaTable();
}
结果 DataTable
将包含输出架构。
如果我没记错的话,你不需要为这个工作传递参数。
例如,您有一个存储过程,标题为:sp_test
当您拖入 LinqToSql 时,它会生成 sp_testResult
class 并将存储过程输出列作为其属性。
我想知道LinqToSql如何区分存储过程的输出结果?
这是 SqlCommandBuilder.GetSchemaTable(...)
中发生的事情,可悲的是 protected
。
SqlCommand command; // setup as SP
using (SqlDataReader reader = command.ExecuteReader(
CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly))
{
return reader.GetSchemaTable();
}
结果 DataTable
将包含输出架构。
如果我没记错的话,你不需要为这个工作传递参数。