Servicestack ORMLite/Massive使用Expandos/Dynamic管理多个DataTable? [英] Servicestack ORMLite/Massive managing multiple DataTables with Expandos / Dynamic?
问题描述
我有一个存储过程,该存储过程会根据输入返回具有动态类型的多个数据表,而我无法对其进行修改或拆分.
i have a Stored Procedure that returns multiple datatables with dynamic types according to the input and I cannot modify or split it.
我实际上是通过这种方式检索数据的:
I actually retrieve the data in this way:
var massiveModel = new DynamicModel(dbConn.ConnectionString);
var connection = new SqlConnection(@"Data Source=127.0.0.1;Initial Catalog=TEST;User ID=as;Password=;Application Name=BRUCE_WAYNE");
connection.Open();
var massiveConnection = connection;
var tmp = massiveModel.Query("exec MY_SP 4412 '20131016' ", MassiveConnection).ToList();
我如何处理这些多个数据表,同时又具有动态检测每个表的列类型的功能?
How can I handle those multiple datatables while keeping also the capability to dynamically detect the types for each table's column?
预计会
推荐答案
我会试一试精巧的点网.
I would give dapper dot net a try.
using (var connection = new SqlConnection(@"Data Source=127.0.0.1;Initial Catalog=TEST;User ID=as;Password=;Application Name=BRUCE_WAYNE"))
using (var multi = connection.QueryMultiple("exec MY_SP 4412 '20131016' "))
{
var resultSetOne = multi.Read().ToList();
// Do something to determine the type returned...
var resultSetTwo = multi.Read().ToList();
// Do something to determine the type returned...
}
我还没有尝试过这种确切的情况,但是它应该给您一个提示.有关更多信息,请参见 dapper点网项目站点.
I haven't tried this exact scenario but it should give you a hint to start from. For further information refer to the dapper dot net project site.
这篇关于Servicestack ORMLite/Massive使用Expandos/Dynamic管理多个DataTable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!