我想知道是否可以使用 Massive 调用多表存储过程并返回多个表。这样做的老式方法如下使用 ADO.NET
SqlCommand command = new SqlCommand("UserAppData", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@UserID", SqlDbType.UniqueIdentifier).Value = (Guid)user.ProviderUserKey;
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds);
DataTable dt0 = ds.Tables[0];
DataTable dt1 = ds.Tables[1];
DataTable dt3 = ds.Tables[2];
DataTable dt4 = ds.Tables[3];
理想的解决方案是执行存储过程,然后每个表都有动态对象(不同的表模式),由表命名。
如果这不可行,则将接受将这些表作为动态对象返回而不使用 dt0.Rows[0]["ColumnName"] 语法的任何其他解决方案。我正在寻找像 dt0.Rows.First().UserId 这样的东西。