Exemplo n.º 1
0
    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);
    }