/// <summary> /// Initializes a new instance of the <see cref="SpringMetadataAdapter"/> class. /// </summary> /// <param name="metadata">The metadata to wrap and adapt.</param> public SpringMetadataAdapter(IDbMetadata metadata) { this.metadata = metadata; // determine correct binary enum type Type parameterType = metadata.ParameterDbType; FieldInfo blobField = parameterType.GetField("Blob"); FieldInfo imageField = parameterType.GetField("Image"); if (blobField != null) { // uses Blob, for example Oracle dbTypeBinary = (Enum)blobField.GetValue(Activator.CreateInstance(parameterType)); } else if (imageField != null) { // uses Image, SQL Server dbTypeBinary = (Enum)imageField.GetValue(Activator.CreateInstance(parameterType)); } else { // use standard binary type dbTypeBinary = DbType.Binary; } }
/// <summary> /// Initializes a new instance of the <see cref="SpringMetadataAdapter"/> class. /// </summary> /// <param name="metadata">The metadata to wrap and adapt.</param> public SpringMetadataAdapter(IDbMetadata metadata) { this.metadata = metadata; // determine correct binary enum type Type parameterType = metadata.ParameterDbType; FieldInfo blobField = parameterType.GetField("Blob"); FieldInfo imageField = parameterType.GetField("Image"); if (blobField != null) { // uses Blob, for example Oracle dbTypeBinary = (Enum) blobField.GetValue(Activator.CreateInstance(parameterType)); } else if (imageField != null) { // uses Image, SQL Server dbTypeBinary = (Enum) imageField.GetValue(Activator.CreateInstance(parameterType)); } else { // use standard binary type dbTypeBinary = DbType.Binary; } }