关于新版本微软企业的Libarary 6,他们纷纷打电话的方法ExecuteSprocAccessor
(应返回Ienumerable<T>
当执行SP),这所有的过载是:企业库6 ExecuteSprocAccessor过载?
用法示例:
/*1*/ [Description("Return data as a sequence of objects using a stored procedure")]
/*2*/ static void ReadDataAsObjects()
/*3*/ {
/*4*/ // Create an object array and populate it with the required parameter values
/*5*/ object[] paramArray = new object[] { "%bike%" };
/*6*/ // Create and execute a sproc accessor that uses default parameter and outpu`t mappings
/*7*/ IEnumerable<Product> productData = defaultDB.ExecuteSprocAccessor<Product>("GetProductList", paramArray);
/*8*/ //...
/*9*/ //...
/*10*/ }
附加信息:
参数添加机制(此处)非常成问题,因为没有ParameterName to value
关联。
他们做的有(第5行)
object[] paramArray = new object[] { "%bike%" };
所以我想如果我有更多然后1个PARAM它看起来像:
object[] paramArray = new object[] { "%bike%",19,"lala"... };
这意味着我必须知道sp的param输入顺序的顺序!
NB
其他方法确实有这种附加价值来命名的:
defaultDB.AddInParameter(sprocCmd, "state", DbType.String, "New York");
问题
是否有使用ExecuteSprocAccessor
现在仍然如此ParameterName to value
关联的方法吗? (假设我不知道SP输入参数为了
刚奇迹:他们确实做到了'ParameterName to value'(AddInParameter)与其他方法匹配。为什么不在这里呢? –