private static ProviderInfo GetProviderInfo(DbProviderFactory dbProviderFactory)
{
Debug.Assert(dbProviderFactory != null);
var parameter = dbProviderFactory.CreateParameter();
if (parameter == null)
throw new NotSupportedException();
var specificTypeProperties =
from property in parameter.GetType().GetProperties()
let attribute = (DbProviderSpecificTypePropertyAttribute)Attribute.GetCustomAttribute(property, typeof(DbProviderSpecificTypePropertyAttribute), false)
where attribute != null
&& attribute.IsProviderSpecificTypeProperty
select property;
var specificTypeProperty = specificTypeProperties.Single();
var specificType = specificTypeProperty.PropertyType;
var clobDbType = GetEnumValueOfAny(specificType, "NClob");
var refCursorDbType = GetEnumValueOfAny(specificType, "Cursor", "RefCursor");
return new ProviderInfo(specificTypeProperty, clobDbType, refCursorDbType);
}