Пример #1
0
        public static ReturnValueApiDescriptionModel Create(Type type)
        {
            var unwrappedType = AsyncHelper.UnwrapTask(type);

            return(new ReturnValueApiDescriptionModel
            {
                Type = TypeHelper.GetFullNameHandlingNullableAndGenerics(unwrappedType),
                TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(unwrappedType)
            });
        }
 public static MethodParameterApiDescriptionModel Create(ParameterInfo parameterInfo)
 {
     return(new MethodParameterApiDescriptionModel
     {
         Name = parameterInfo.Name,
         TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(),
         Type = TypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType),
         TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(parameterInfo.ParameterType),
         IsOptional = parameterInfo.IsOptional,
         DefaultValue = parameterInfo.HasDefaultValue ? parameterInfo.DefaultValue : null
     });
 }
 public static ParameterApiDescriptionModel Create(string name, string nameOnMethod, Type type, bool isOptional = false, object defaultValue = null, string[] constraintTypes = null, string bindingSourceId = null, string descriptorName = null)
 {
     return(new ParameterApiDescriptionModel
     {
         Name = name,
         NameOnMethod = nameOnMethod,
         Type = type != null?TypeHelper.GetFullNameHandlingNullableAndGenerics(type) : null,
                    TypeSimple = type != null?ApiTypeNameHelper.GetSimpleTypeName(type) : null,
                                     IsOptional = isOptional,
                                     DefaultValue = defaultValue,
                                     ConstraintTypes = constraintTypes,
                                     BindingSourceId = bindingSourceId,
                                     DescriptorName = descriptorName
     });
 }