Пример #1
0
 internal static IGraphElementPropertyModel FromGraphElementModels(params IGraphElementModel[] models)
 {
     return(Default
            .ConfigureMetadata(_ => models
                               .SelectMany(model => model.Metadata.Keys)
                               .SelectMany(x => x.GetTypeHierarchy())
                               .Distinct()
                               .SelectMany(type => type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly))
                               .ToImmutableDictionary(
                                   property => property,
                                   property => new PropertyMetadata(property.Name),
                                   MemberInfoEqualityComparer.Instance)));
 }
Пример #2
0
 public static IGraphElementPropertyModel ConfigureElement <TElement>(this IGraphElementPropertyModel model, Func <IPropertyMetadataConfigurator <TElement>, IImmutableDictionary <MemberInfo, PropertyMetadata> > action)
     where TElement : class
 {
     return(model.ConfigureMetadata(
                metadata => action(new PropertyMetadataConfigurator <TElement>(metadata))));
 }
Пример #3
0
 public static IGraphElementPropertyModel ConfigureNames(this IGraphElementPropertyModel model, Func <MemberInfo, string, string> overrideTransformation)
 {
     return(model.ConfigureMetadata(_ => _.ConfigureNames(overrideTransformation)));
 }