//向参数以数组的形式加载所有数据对象 private void LoadParameter(DbCommand command, DbOperateBase operate) { if (MemberParameters.Count > 0) { var items = (IDbSplitObjectsOperate)operate; if (items.Count == 1) { foreach (var item in items) { LoadParameter(item); } foreach (var parameter in ReturnParameters) { parameter.Parameter.Value = GetDefaultValue(parameter.Metadata.StorageType); var storageType = parameter.Metadata.StorageType; if (!storageType.IsValueType) { parameter.Parameter.Size = 4000; } } } else { var index = 0; var arrayList = MemberParameters.ToDictionary(a => a.Parameter, a => { var values = Array.CreateInstance(a.Metadata.StorageType, items.Count); a.Parameter.Value = values; return(values); }); var loader = Loader; foreach (var item in items) { loader.Load(item); foreach (var p in MemberParameters) { arrayList[p.Parameter].SetValue(Loader[p.Index], index); } index++; } OracleAccessProvider.SetArrayBindCount(command, items.Count); int[] shortArray = null, longArray = null; foreach (var member in ReturnParameters) { var storageType = member.Metadata.StorageType; member.Parameter.Value = Array.CreateInstance(storageType, items.Count); if (storageType.IsValueType) { shortArray = shortArray ?? Utility.Array(items.Count, 38); OracleAccessProvider.SetArrayBindSize(member.Parameter, shortArray); } else { longArray = longArray ?? Utility.Array(items.Count, 4000); OracleAccessProvider.SetArrayBindSize(member.Parameter, longArray); } } foreach (var para in SimpleParameters) { var value = para.Value; var values = Array.CreateInstance(value.GetType(), items.Count); for (int i = 0; i < values.Length; i++) { values.SetValue(value, i); } para.Value = values; } } } }
public OracleCustomCommand(OracleAccessProvider provider) { _Factory = provider.Factory; InitialOracleCompnent(_Factory.GetType()); }