public IsKeyProperty ( |
||
type | Entity type for which metadata is being generated | |
propertyInfo | Property being considered | |
return | bool |
/// <summary> /// Add the properties for an entity type. /// </summary> /// <param name="type">Type for which metadata is being generated</param> /// <param name="dataList">will be populated with the data properties of the entity</param> void AddDataProperties(Type type, List <Dictionary <string, object> > dataList) { // Get properties for the given class var propertyInfos = GetPropertyInfos(type); foreach (var propertyInfo in propertyInfos) { var elementType = GetElementType(propertyInfo.PropertyType); if (_entityTypes.Contains(elementType) || (_entityTypes.Contains(_describer.Replace(elementType, _allTypes)))) { // association to another entity in the metadata list; skip until later } else { // data property var isKey = _describer.IsKeyProperty(type, propertyInfo); var isVersion = _describer.IsVersionProperty(type, propertyInfo); var dmap = MakeDataProperty(type, propertyInfo, isKey, isVersion); if (dmap == null) { continue; // excluded } dataList.Add(dmap); // add enum types to the global enum list var realType = propertyInfo.PropertyType; var types = propertyInfo.PropertyType.GetGenericArguments(); if (types.Length > 0) { realType = types[0]; } if (realType.IsEnum) { if (!_enumList.Exists(x => x.ContainsValue(realType.Name))) { string[] enumNames = Enum.GetNames(realType); var p = new Dictionary <string, object>(); p.Add("shortName", realType.Name); p.Add("namespace", realType.Namespace); p.Add("values", enumNames); _enumList.Add(p); } } } } }