public static ReadOnlyArray <ElementProperty <OpenXmlElement> > GetElements(Func <Type, Func <OpenXmlElement> > activatorFactory, Func <Type, SchemaAttrAttribute> elementSchemaFactory, Type type)
        {
            SchemaIndex GetSchema(PropertyInfo property)
            {
                var index  = property.GetCustomAttribute <IndexAttribute>();
                var schema = elementSchemaFactory(property.PropertyType);

                return(new SchemaIndex(schema, index));
            }

            return(ElementPropertyCollection <OpenXmlElement> .GetProperties(activatorFactory, type, GetSchema));
        }
Exemplo n.º 2
0
 public OpenXmlElementData(Type type, PackageCache cache)
 {
     _rawAttributes = new Lazy <ReadOnlyArray <ElementProperty <OpenXmlSimpleType> > >(() => ElementPropertyCollection.GetProperties(cache.GetFactory <OpenXmlSimpleType>, type), true);
     _rawElements   = new Lazy <ReadOnlyArray <ElementProperty <OpenXmlElement> > >(() => ElementPropertyCollection.GetElements(cache.GetFactory <OpenXmlElement>, t => cache.ParseElementData(t).Info.Schema, type), true);
     _info          = new Lazy <ElementTypeInfo>(() => ElementTypeInfo.Create(type), true);
     _children      = new Lazy <ElementLookup>(() => ElementLookup.CreateLookup(type, cache.GetFactory <OpenXmlElement>), true);
 }