Beispiel #1
0
        public static PropertyInfo GetKeyPropertyByName()
        {
            string typeName      = typeof(TItem).Name;
            var    possibleNames = IdConventionPrimaryKeyFinder.GetPossibleIdNames(typeName);

            PropertyInfo[] properties = typeof(TItem).GetProperties();
            foreach (PropertyInfo property in properties)
            {
                if (possibleNames.Contains(property.Name))
                {
                    return(property);
                }
            }

            throw new KeyNotFoundException("Identifier could not be determined for item type " + typeof(TItem).Name);
        }
        private static Display GetDefaultDisplayFromName(string itemName, string fieldName)
        {
            bool isId = IdConventionPrimaryKeyFinder.GetPossibleIdNames(itemName).Contains(fieldName);

            return(isId ? Display.Nested : Display.FullItem);
        }