private static bool CanUseExtendedProperty(string connectionString)
{
if (extendedPropertyEnabled == null)
{
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
try
{
conn.ConnectionString = connectionString;
conn.Open();
SqlCommand cmdGetExtProp = new SqlCommand();
cmdGetExtProp.CommandText = "SELECT value FROM ::fn_listextendedproperty('', '', '', '', '', '', '')";
cmdGetExtProp.CommandType = System.Data.CommandType.Text;
cmdGetExtProp.Connection = conn;
cmdGetExtProp.ExecuteNonQuery();
extendedPropertyEnabled = true;
}
catch (Exception ex)
{
extendedPropertyEnabled = false;
}
finally
{
if (conn != null)
conn.Close();
}
}
return extendedPropertyEnabled.Value;
}