public StructuredParameterReader(StructuredParameterSchemaBase schema, IEnumerable values)
 {
     if (schema == null) {
         throw new ArgumentNullException("schema");
     }
     this.schema = schema;
     data = new object[schema.MappedColumns.Count];
     if (values != null) {
         enumerator = values.GetEnumerator();
         if (!enumerator.MoveNext()) {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable != null) {
                 disposable.Dispose();
             }
             enumerator = null;
         }
     }
 }
 public SqlCallParameterInfo(ParameterInfo parameter, ISerializationTypeInfoProvider typeInfoProvider, ref int outArgCount)
 {
     if (parameter == null) {
         throw new ArgumentNullException("parameter");
     }
     if (typeInfoProvider == null) {
         throw new ArgumentNullException("typeInfoProvider");
     }
     this.typeInfoProvider = typeInfoProvider;
     SqlArgAttribute arg = GetSqlArgAttribute(parameter);
     parameterName = arg.Name;
     parameterType = parameter.ParameterType;
     if (parameterType.IsByRef) {
         parameterType = parameterType.GetElementType();
     }
     sqlType = (arg.Type != null) ? arg.Type.Value : typeInfoProvider.TypeMappingProvider.GetMapping(parameter.ParameterType).DbType;
     size = arg.Size;
     if ((size == 0) && ((sqlType == SqlDbType.NChar) || (sqlType == SqlDbType.Char))) {
         size = 1;
     }
     nullable = arg.Nullable;
     if (parameter.ParameterType.IsNullableType()) {
         nullable = true;
     } else if (parameter.ParameterType.IsValueType) {
         nullable = false;
     }
     position = parameter.Position;
     if (parameter.ParameterType.IsByRef) {
         if (sqlType == SqlDbType.Structured) {
             throw new NotSupportedException("Table valued parameters only support readonly inputs!");
         }
         direction = parameter.IsOut ? ParameterDirection.Output : ParameterDirection.InputOutput;
     }
     if (direction != ParameterDirection.Input) {
         outArgPosition = outArgCount++;
     }
     if (sqlType == SqlDbType.Structured) {
         structuredSchema = new StructuredParameterSchema(typeInfoProvider.GetSerializationTypeInfo(parameterType.GetGenericArguments()[0]), typeInfoProvider.TypeMappingProvider);
     }
     if ((sqlType == SqlDbType.Udt) && string.IsNullOrEmpty(arg.UserDefinedTypeName)) {
         userDefinedTypeName = GetClrUserDefinedTypeName(parameter.ParameterType);
     }
 }