void FillRowDataKey (object dataItem)
{
KeyTable.Clear ();
if (cachedKeyProperties == null) {
PropertyDescriptorCollection props = TypeDescriptor.GetProperties (dataItem);
cachedKeyProperties = new PropertyDescriptor [DataKeyNames.Length];
for (int n=0; n<DataKeyNames.Length; n++) {
PropertyDescriptor p = props.Find (DataKeyNames [n], true);
if (p == null)
throw new InvalidOperationException ("Property '" + DataKeyNames[n] + "' not found in object of type " + dataItem.GetType());
cachedKeyProperties [n] = p;
}
}
foreach (PropertyDescriptor p in cachedKeyProperties)
KeyTable [p.Name] = p.GetValue (dataItem);
}