Exemple #1
0
        /// <summary>
        /// Imports all definitions from the static class fields.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="classType"></param>
        public static ModelNode AddDefinitionsFromStaticClassType(this ModelNode node, Type classType)
        {
            foreach (var field in classType.GetFields(BindingFlags.Public | BindingFlags.Static))
            {
                var definition = field.GetValue(null) as DefinitionBase;

                if (definition != null)
                {
                    node.CreateDefinitionNode(definition);
                }
            }

            foreach (var prop in classType.GetProperties(BindingFlags.Public | BindingFlags.Static))
            {
                var definition = prop.GetValue(null, null) as DefinitionBase;

                if (definition != null)
                {
                    node.CreateDefinitionNode(definition);
                }
            }

            return(node);
        }