private static IEntityPropertyDefinition GetFirstEntityProperty( IEntityType entityType) { // Simple types are non business types/ non navigation properties IEnumerable <IEntityPropertyDefinition> simpleTypeProperties = entityType.Properties.Where(p => p.PropertyType is ISimpleType); // Find the first string property, or the first one that can // be represented as a string IEntityPropertyDefinition defaultSummaryProperty = simpleTypeProperties.FirstOrDefault( p => CustomEditorHelper.GetBaseSystemType( (ISimpleType)p.PropertyType) == typeof(string)) ?? simpleTypeProperties.FirstOrDefault( p => CustomEditorHelper.IsTextProperty(p)); return(defaultSummaryProperty); }
public static IEntityPropertyDefinition GetSummaryProperty(IEntityType entityType) { //Return the specified property if one is specified ISummaryPropertyAttribute attribute = entityType.Attributes.OfType <ISummaryPropertyAttribute>().FirstOrDefault(); if (attribute != null && attribute.Property != null) { return(attribute.Property); } //If none is specified, try to infer one IEnumerable <IEntityPropertyDefinition> properties = entityType.Properties.Where(p => (!(p is INavigationPropertyDefinitionBase)) && (!p.PropertyType.Name.Contains("Binary"))); IEntityPropertyDefinition stringProperty = properties.FirstOrDefault(p => p.PropertyType.Name.Contains("String")); if (stringProperty == null) { return(properties.FirstOrDefault()); } else { return(stringProperty); } }
public static bool IsComputed(IEntityPropertyDefinition entityProperty) { return(entityProperty.Attributes.OfType <IComputedAttribute>().Any()); }
public static bool IsComputed(IEntityPropertyDefinition entityProperty) { return entityProperty.Attributes.OfType<IComputedAttribute>().Any(); }