0
我想將poco屬性傳遞給存儲過程(更新並添加對象) 對於早期版本的企業庫(例如v2.0),我可以這樣做:如何使用Enterprise-Library 5.0更新poco
var arrParam = SqlHelperParameterCache.GetSpParameterSet(ConnectionString(),
SprocNameSet);
for (int x = 0; x <= arrParam.Length - 1; x++)
{
System.Reflection.PropertyInfo pi =
dataObject.GetType()
.GetProperty(arrParam[x].ParameterName
.Substring(1, Convert.ToInt32(arrParam[x].ParameterName.Length) - 1));
arrParam[x].Value = pi.GetValue(myDataObject, null);
}
SqlHelper.ExecuteScalar(ConnectionString(),
CommandType.StoredProcedure,
SprocNameSet,
arrParam);
但隨着5.0版本(也許更早?)的SqlHelperParameterCache.GetSpParameterSet方法已經一去不復返了。
現在的問題是:如何獲取stored-proc參數並使用poco-properties-values填充這些參數?