0

poco プロパティをストアド プロシージャに渡したい (オブジェクトを更新して追加する) Enterprise Library の以前のバージョン (v2.0 など) では、次のようなことができます。

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-Parameters を取得して、これらに poco-properties-values を入力するにはどうすればよいかということです。

4

1 に答える 1