public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
PropertyDescriptorCollection coll =
TypeDescriptor.GetProperties(this, attributes, true);
List<PropertyDescriptor> props = new List<PropertyDescriptor>();
foreach (PropertyDescriptor pd in coll)
{
if (!pd.IsBrowsable) continue;
if (pd.Name == "IsUnique" || pd.Name == "Name" || pd.Name == "Type")
{
if (IsPrimary)
{
CustomPropertyDescriptor newPd = new CustomPropertyDescriptor(pd);
newPd.SetReadOnly(true);
props.Add(newPd);
}
}
else if (pd.Name == "FullText" && (Spatial ||
String.Compare(table.Engine, "myisam", true) != 0))
{
CustomPropertyDescriptor newPd = new CustomPropertyDescriptor(pd);
newPd.SetReadOnly(true);
props.Add(newPd);
}
else if (pd.Name == "Spatial" && (FullText ||
String.Compare(table.Engine, "myisam", true) != 0))
{
CustomPropertyDescriptor newPd = new CustomPropertyDescriptor(pd);
newPd.SetReadOnly(true);
props.Add(newPd);
}
else
props.Add(pd);
}
return new PropertyDescriptorCollection(props.ToArray());
}