Пример #1
0
        public static List <IObjectLogPropertyDefinition <T> > GetSchemaEntries(ObjectLogSchema schema)
        {
            List <IObjectLogPropertyDefinition <T> > list = new List <IObjectLogPropertyDefinition <T> >();

            FieldInfo[] fields = schema.GetType().GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
            foreach (FieldInfo fieldInfo in fields)
            {
                object          value           = fieldInfo.GetValue(null);
                ObjectLogSchema objectLogSchema = value as ObjectLogSchema;
                if (objectLogSchema != null)
                {
                    list.AddRange(ObjectLog <T> .GetSchemaEntries(objectLogSchema));
                }
                else
                {
                    IObjectLogPropertyDefinition <T> objectLogPropertyDefinition = value as IObjectLogPropertyDefinition <T>;
                    if (objectLogPropertyDefinition != null)
                    {
                        if (schema.ExcludedProperties == null || !schema.ExcludedProperties.Contains(objectLogPropertyDefinition.FieldName))
                        {
                            list.Add(objectLogPropertyDefinition);
                        }
                    }
                    else
                    {
                        IEnumerable <IObjectLogPropertyDefinition <T> > enumerable = value as IEnumerable <IObjectLogPropertyDefinition <T> >;
                        if (enumerable != null)
                        {
                            foreach (IObjectLogPropertyDefinition <T> objectLogPropertyDefinition2 in enumerable)
                            {
                                if (schema.ExcludedProperties == null || !schema.ExcludedProperties.Contains(objectLogPropertyDefinition2.FieldName))
                                {
                                    list.Add(objectLogPropertyDefinition2);
                                }
                            }
                        }
                    }
                }
            }
            return(list);
        }