Ejemplo n.º 1
0
        /// <summary>
        /// Processes the specified property and returns a <see cref="FieldType"/>
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        protected virtual FieldType?ProcessProperty(PropertyInfo property)
        {
            var fieldType = GraphTypeHelper.CreateField(
                property,
                () => InferGraphType(ApplyAttributes(GetTypeInformation(property))));

            if (fieldType == null)
            {
                return(null);
            }
            //create the field resolver
            fieldType.Resolver = new PropertyResolver(property);
            //return the field
            return(fieldType);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Processes the specified property and returns a <see cref="FieldType"/>
        /// </summary>
        /// <param name="property"></param>
        /// <returns></returns>
        protected virtual FieldType?ProcessProperty(PropertyInfo property)
        {
            var fieldType = GraphTypeHelper.CreateField(
                property,
                () => InferGraphType(ApplyAttributes(GetTypeInformation(property))));

            if (fieldType == null)
            {
                return(null);
            }
            //load the default value
            fieldType.DefaultValue = property.GetCustomAttribute <DefaultValueAttribute>()?.Value;
            //return the field
            return(fieldType);
        }