private void AddParametersWithValueToCommand(IDbCommand command, params object[] parameters) { if (parameters == null || parameters.Length == 0) { return; } foreach (object parameter in parameters) { if (parameter != null && false == (parameter is DBNull)) { IDbAnonymousValue anonymousParam = parameter as IDbAnonymousValue; if (anonymousParam != null) { DbAutoFillHelper.AddParameterWithValue(command, anonymousParam.Alias, anonymousParam.GetValue(), null); } else { DbAutoFillHelper.FillDbParametersFromObject(command, parameter); } } } }
private static void SetDbAnonymousValueFromDataReader(IDbAnonymousValue anonymousValue, IDataReader dr) { anonymousValue.SetValue(Convert.ChangeType(dr[0], anonymousValue.GetType().GetGenericArguments()[0])); }