Example #1
0
        /// <summary>
        /// 将请求Form或Query转换为参数模型
        /// </summary>
        /// <param name="request">请求数据</param>
        /// <param name="parameter">参数</param>
        /// <returns></returns>
        private object GenerateModelFromQueryForm(HttpRequest request, ApiParameter parameter)
        {
            var name       = parameter.Name;
            var targetType = parameter.Type;

            if (targetType.IsComplexClass() == true)
            {
                return(this.QueryFormToComplex(request, parameter));
            }

            // 转换为数组
            var values = request.GetValues(name);

            if (targetType.IsArrayOrList() == true)
            {
                return(Converter.Cast(values, targetType));
            }

            // 转换为简单类型 保留参数默认值
            var value = values.FirstOrDefault();

            if (value == null && parameter.Info.DefaultValue != DBNull.Value)
            {
                return(parameter.Info.DefaultValue);
            }
            return(Converter.Cast(value, targetType));
        }
        public IActionResult deletedata(int id)
        {
            ApiParameter        apt    = new ApiParameter();
            List <ApiParameter> lapt   = new List <ApiParameter>();
            WebClient           client = new WebClient();

            client.UseDefaultCredentials = true;
            var Url      = "https://localhost:44352/api/Personnel/Deletepersonnel";
            var Response = "";

            apt       = new ApiParameter();
            apt.Name  = "id";
            apt.Value = id.ToString();
            lapt.Add(apt);

            foreach (var p in lapt)
            {
                client.QueryString.Add(p.Name, p.Value);
            }
            var DeleteResponse  = client.UploadValues(Url, "DELETE", client.QueryString);
            var DResponseString = UnicodeEncoding.UTF8.GetString(DeleteResponse);

            Response = DResponseString;

            return(Ok(Response));
        }
Example #3
0
        public void TheUserSearchesFor(string searchTerm)
        {
            var param = new ApiParameter();

            param.AddDefaultByQuery(searchTerm);
            _context.Set(StepTitle.SearchTerm, param);
        }
        public async Task <bool> AddOrUpdateApiParaAsync(ApiParameter para)
        {
            var isAdd = false;
            var model = await context.ApiParameters.Where(p => p.ApiUrlID == para.ApiUrlID && p.ParaID == para.ParaID).FirstOrDefaultAsync();

            if (model == null)
            {
                isAdd = true;
                model = new ApiParameter()
                {
                    ApiUrlID = para.ApiUrlID
                };
            }
            model.CName      = para.CName;
            model.EName      = para.EName;
            model.DataType   = para.DataType;
            model.InOROutPut = para.InOROutPut;
            model.IsNull     = para.IsNull;
            model.Remark     = para.Remark;
            if (isAdd)
            {
                context.ApiParameters.Add(model);
            }
            return(await context.SaveChangesAsync() == 1);
        }
        /// <summary>
        /// 从Form或Query获取参数值
        /// </summary>
        /// <param name="request">请求数据</param>
        /// <param name="parameter">参数</param>
        /// <returns></returns>
        private object GetValueFromQueryForm(HttpRequest request, ApiParameter parameter)
        {
            var name       = parameter.Name;
            var targetType = parameter.Type;

            if (targetType.IsClass == true && targetType.IsArray == false && targetType != typeof(string))
            {
                return(this.QueryFormToClass(request, parameter));
            }

            // 转换为数组
            var values = request.GetValues(name);

            if (targetType.IsArray == true)
            {
                return(Converter.Cast(values, targetType));
            }

            // 转换为简单类型 保留参数默认值
            var value = values.FirstOrDefault();

            if (value == null && parameter.Info.DefaultValue != DBNull.Value)
            {
                return(parameter.Info.DefaultValue);
            }
            return(Converter.Cast(value, targetType));
        }
Example #6
0
        static string ToStringPostfix(ApiParameter param)
        {
            var sb = new StringBuilder();

            if (param.IsValueType && !param.Required)
            {
                sb.Append(".Value");
            }
            switch (param.Type)
            {
            case ApiParameterType.@string:
                break;

            case ApiParameterType.boolean:
                sb.Append(" ? \"true\" : \"false\"");
                break;

            case ApiParameterType.numeric:
                sb.Append(".ToString(CultureInfo.InvariantCulture)");
                break;

            default:
                throw new NotImplementedException("Unknown type: " + param.Type);
            }
            return(sb.ToString());
        }
Example #7
0
        static ApiParameter CreateParameter(
            ISymbol symbol,
            MetadataItem item,
            bool isReturn = false
            )
        {
            var type = symbol switch
            {
                IParameterSymbol s => s.Type,
                IEventSymbol s => s.Type,
                IPropertySymbol s => s.Type,
                IFieldSymbol s => s.Type,
                _ => throw new ArgumentException(
                          $"Symbol {symbol.Kind} is not supported",
                          nameof(symbol)
                          )
            };

            return(ApiParameter.Create(symbol, item, type.ToDisplayString(), isReturn));
        }

        MetadataItem?GetMetadataItem(ISymbol symbol)
        {
            var item = DefaultVisit(symbol);

            if (item == null)
            {
                return(null);
            }

            item.Type = symbol.GetMemberTypeFromSymbol();
            return(item.Type == MemberType.Default ? null : item);
        }

        List <MetadataItem> VisitDescendants <T>(
            IEnumerable <T> children,
            Func <T, IEnumerable <T> > getChildren,
            Func <T, bool> filter
            ) where T : ISymbol
        {
            var result = new List <MetadataItem>();
            var stack  = new Stack <T>(children.Reverse());

            while (stack.Count > 0)
            {
                var child = stack.Pop();

                if (filter(child))
                {
                    result.AddNotNull(child.Accept(this));
                }

                foreach (var m in getChildren(child).Reverse())
                {
                    stack.Push(m);
                }
            }

            return(result);
        }
            public bool IsRequired(bool requireParametersWithoutDefault)
            {
                var isRequired = false;

                // available in asp.net core >= 2.2
                if (ApiParameter.HasProperty("IsRequired"))
                {
                    isRequired = ApiParameter.TryGetPropertyValue("IsRequired", false);
                }
                else
                {
                    // fallback for asp.net core <= 2.1
                    if (ApiParameter.Source == BindingSource.Body)
                    {
                        isRequired = true;
                    }
                    else if (ApiParameter.ModelMetadata != null &&
                             ApiParameter.ModelMetadata.IsBindingRequired)

                    {
                        isRequired = true;
                    }
                    else if (ApiParameter.Source == BindingSource.Path &&
                             ApiParameter.RouteInfo != null &&
                             ApiParameter.RouteInfo.IsOptional == false)
                    {
                        isRequired = true;
                    }
                }

                return(isRequired || (requireParametersWithoutDefault && ParameterInfo?.HasDefaultValue != true));
            }
Example #9
0
 string GetParameterTypeName(ApiParameter parameter)
 {
     if (parameter.IsFile)
     {
         return("Blob");
     }
     return(GetTypeName(parameter.Type));
 }
Example #10
0
        public async Task <JsonResult> SaveUrlPara(ApiParameter para)
        {
            using (ApiManaRepository rep = new ApiManaRepository())
            {
                var res = await rep.AddOrUpdateApiParaAsync(para);

                return(Json(new { isOk = res }));
            }
        }
Example #11
0
        public static uint GetValue(ApiParameter parameter, IntPtr address)
        {
            ApiRecord record;
            IntPtr    realAddress;

            record      = ApiInfo.Instance[parameter];
            realAddress = ApiProxy.GetAddress(record.Group, address);

            return(ApiProxy.InternalGetValue(record.Shift, record.Size, IntPtr.Add(realAddress, record.Offset)));
        }
Example #12
0
        public static void SetValue(ApiParameter parameter, IntPtr address, uint value)
        {
            ApiRecord record;
            IntPtr    realAddress;

            record      = ApiInfo.Instance[parameter];
            realAddress = ApiProxy.GetAddress(record.Group, address);

            ApiProxy.InternalSetValue(record, IntPtr.Add(realAddress, record.Offset), value);
        }
Example #13
0
 public ApiMethod(string iname, string name, bool needSession, string[] needPermissions, CallFormatter formatter, ApiParameter[] parameters)
 {
     this.iname = iname;
     this.name = name;
     this.needSession = needSession;
     this.needPermissions = needPermissions;
     this.formatter = formatter;
     this.parameters = parameters;
     call_counter = new Counter("api." + iname + "." + name + ".call", "number of calls to method (OK or not)");
     error_counter = new Counter("api." + iname + "." + name + ".error", "number of errors in calls to method");
 }
        //Update User
        public IActionResult UpdateUser(int user_ID1, string user_Fristname, string user_Lastname, string user_Department, int user_Level, int user_Status, string user_Createdate, string user_Datemodify, string user_Username, string user_Password)
        {
            ApiParameter        atp    = new ApiParameter();
            List <ApiParameter> lapt   = new List <ApiParameter>();
            WebClient           client = new WebClient();

            client.UseDefaultCredentials = true;
            var Url      = "https://localhost:44351/api/Users/UpdateUser";
            var Response = "";

            JObject Parameters = new JObject(
                new JProperty("user_ID", user_ID1),
                new JProperty("user_Fristname", user_Fristname),
                new JProperty("user_Lastname", user_Lastname),
                new JProperty("user_Department", user_Department),
                new JProperty("user_Level", user_Level),
                new JProperty("user_Status", user_Status),
                new JProperty("createDate", user_Createdate),
                new JProperty("dateModify", user_Datemodify),
                new JProperty("user_Username", user_Username),
                new JProperty("user_Password", user_Password)
                );
            string DataString = Parameters.ToString();

            atp       = new ApiParameter();
            atp.Name  = "/*json*/";
            atp.Value = DataString;
            lapt.Add(atp);

            string PutUrl  = Url;
            string PutBody = "";

            foreach (var p in lapt)
            {
                if (p.Name == "json")
                {
                    PutUrl += "?" + "=" + p.Value;
                }
                else if (p.Name == "Finalurl")
                {
                    PutUrl += p.Value;
                }
                else
                {
                    PutBody += p.Value;
                }
            }
            client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
            client.Encoding = Encoding.UTF8;
            Response        = client.UploadString(PutUrl, "PUT", PutBody);

            return(Ok(Response));
        }
Example #15
0
        public void Unsuccessful_When_No_SearchTerm_Is_Sent()
        {
            var param = new ApiParameter();

            param.AddCurrency("GBP").AddLanguage("en-GB").AddStore("1");

            _annotate.Given(_ => _step.TheUserSearchesFor(param))
            .When(_ => _step.SearchApiIsCalled())
            .Then(_ => _step.TheStatusCodeIs(HttpStatusCode.BadRequest))
            .And(_ => _step.TheErrorContains("The QueryTerm field is required"))
            .BDDfy();
        }
        //public IActionResult EditAsset(int id)
        //{
        //    //List<AssetId.AssetByID> Ass = (List<AssetId.AssetByID>)JsonConvert.DeserializeObject(HttpContext.Session.GetString("data"));
        //    //ViewData.GetViewDataInfo = HttpContext.Session.GetString("Data");
        //     Parameters apt = new Parameters();
        //    List<Parameters> lapt = new List<Parameters>();

        //    List<AssetId.AssetByID> Ass = new List<AssetId.AssetByID>();
        //    List<Assets> last = new List<Assets>();
        //    WebClient client = new WebClient();
        //    client.UseDefaultCredentials = true;
        //    client.Headers[HttpRequestHeader.ContentType] = "application/x-www-from-urlencoded";

        //    string Parameter = string.Empty;
        //    int PLenght = 0;

        //    apt = new Parameters();
        //    apt.Name = "id";
        //    apt.Value = id.ToString();
        //    lapt.Add(apt);

        //    foreach (var p in lapt)
        //    {
        //        if (PLenght == 0) Parameter += "?" + p.Name + "=" + p.Value;
        //        else Parameter += "&" + p.Name + "=" + p.Value;
        //        PLenght++;
        //    }

        //    var Url = "https://localhost:44351/api/Assets/AssetGetById";
        //    var Response = "";

        //    string FinalUrl = Url + Parameter;
        //    var responsedata = client.DownloadData(FinalUrl);
        //    //Response = UnicodeEncoding.UTF8.GetString(responsedata);
        //    Response = UnicodeEncoding.UTF8.GetString(responsedata);

        //    List<AssetID> las = (List<AssetID>)JsonConvert.DeserializeObject(Response, typeof(List<AssetID>));
        //   // Ass.LAssetById = new List<AssetId.AssetByID>();

        //    foreach (var item in las)
        //    {
        //        AssetId.AssetByID ast = new AssetId.AssetByID();

        //        ast.asset_ID = item.asset_ID;
        //        ast.asset_Name = item.asset_Number;
        //        ast.asset_Serial = item.asset_Serial;
        //        ast.type_ID = item.type_ID;
        //        ast.asset_Datebuy = item.asset_Datebuy;
        //        ast.asset_Waranty = item.asset_Waranty;
        //        ast.asset_Price = item.asset_Price;
        //        ast.asset_Supply = item.asset_Supply;
        //        ast.user_ID = item.user_ID;
        //        ast.admin_ID = item.admin_ID;
        //        ast.asset_Number = item.asset_Number;
        //        ast.asset_Modify = item.asset_Modify;

        //        Ass.Add(ast);
        //    }
        //    ViewData["data"] = Ass;
        //    return RedirectToAction(,);
        //}


        public IActionResult Add(string Asset_Name, string Asset_Serial, int Type_ID, string Asset_Datebuy, string Asset_Waranty,
                                 string Asset_Price, string Asset_Supply, int User_ID, int Admin_ID, string Asset_Number, string Asset_Modify)
        {
            ApiParameter        apt  = new ApiParameter();
            List <ApiParameter> lapt = new List <ApiParameter>();

            WebClient Client = new WebClient();

            Client.UseDefaultCredentials = true;
            var Url = "https://localhost:44351/api/Assets/AddAsset";

            JObject Parameters = new JObject(
                new JProperty("asset_Name", Asset_Name),
                new JProperty("asset_Serial", Asset_Serial),
                new JProperty("type_ID", Type_ID),
                new JProperty("asset_Datebuy", Asset_Datebuy),
                new JProperty("asset_Waranty", Asset_Waranty),
                new JProperty("asset_Price", Asset_Price),
                new JProperty("asset_Supply", Asset_Supply),
                new JProperty("user_ID", User_ID),
                new JProperty("admin_ID", Admin_ID),
                new JProperty("asset_Number", Asset_Number),
                new JProperty("asset_Modify", Asset_Modify)
                );
            string DataStrting = Parameters.ToString();
            var    Response    = "";

            apt       = new ApiParameter();
            apt.Name  = "Json";
            apt.Value = DataStrting;
            lapt.Add(apt);

            string PostUrl  = Url + "?";
            string PostBody = "";

            foreach (var p in lapt)
            {
                if (p.Name == "Json")
                {
                    PostBody += p.Value;
                }
                else
                {
                    PostUrl += p.Name + "=" + p.Value + "&";
                }
            }
            PostUrl = PostUrl.Remove(PostUrl.Length - 1);
            Client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
            Client.Encoding = Encoding.UTF8;
            Response        = Client.UploadString(PostUrl, "POST", PostBody);

            return(Ok(Response));
        }
Example #17
0
 public ApiRecord(ApiParameter parameter, ApiGroup group, string displayName, string description, int offset, int shift, int size)
 {
     this.Parameter   = parameter;
     this.Group       = group;
     this.DisplayName = displayName;
     this.Description = description;
     this.Offset      = offset;
     this.Shift       = shift;
     this.Size        = size;
     this.Min         = 0;
     this.Max         = (uint)(Math.Pow(2, size) - 1);
 }
Example #18
0
 public ApiRecord(ApiParameter parameter, ApiGroup group, string displayName, string description, int offset, int shift, int size, uint min, uint max)
 {
     this.Parameter   = parameter;
     this.Group       = group;
     this.DisplayName = displayName;
     this.Description = description;
     this.Offset      = offset;
     this.Shift       = shift;
     this.Size        = size;
     this.Min         = min;
     this.Max         = max;
 }
Example #19
0
 public static ApiParameterBuildOutput FromModel(ApiParameter model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new ApiParameterBuildOutput
     {
         Name = model.Name,
         Type = ApiNames.FromUid(model.Type),
         Description = model.Description,
     });
 }
Example #20
0
 public virtual IActionResult GetAll(ApiParameter parameter)
 {
     try
     {
         var parameters = parameter.ProcessParameters(Request.Query);
         parameters.Filters.Add(DtoMetadata.Instance.Convention.ActiveProperty, true);
         var list = ListService.GetList(Service, parameters);
         return(Ok(list));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex.GetInnerMessages()));
     }
 }
Example #21
0
 public static ApiParameterBuildOutput FromModel(ApiParameter model, Dictionary <string, ApiReferenceBuildOutput> references, string[] supportedLanguages)
 {
     if (model == null)
     {
         return(null);
     }
     return(new ApiParameterBuildOutput
     {
         Name = model.Name,
         Type = ApiBuildOutputUtility.GetApiNames(model.Type, references, supportedLanguages),
         Description = model.Description,
         _needExpand = false,
     });
 }
        /// <summary>
        /// 将body转换为模型
        /// </summary>
        /// <param name="body">原始数据</param>
        /// <param name="parameter">参数</param>
        /// <returns></returns>
        private object GetModelFromBody(object body, ApiParameter parameter)
        {
            if (body != null)
            {
                return(Converter.Cast(body, parameter.Type));
            }

            var defaultValue = parameter.Info.DefaultValue;

            if (defaultValue == DBNull.Value)
            {
                defaultValue = null;
            }
            return(defaultValue);
        }
        //AddUser
        public IActionResult AddUser(string user_Fristname, string user_Lastname, string user_Department, int user_Level, int user_Status, string user_Createdate, string user_DateModify, string user_Username, string user_Password)
        {
            ApiParameter        apt    = new ApiParameter();
            List <ApiParameter> lapt   = new List <ApiParameter>();
            WebClient           client = new WebClient();

            client.UseDefaultCredentials = true;
            var Url = "https://localhost:44351/api/Users/AddUser";

            JObject Parameters = new JObject(
                new JProperty("user_Fristname", user_Fristname),
                new JProperty("user_Lastname", user_Lastname),
                new JProperty("user_Department", user_Department),
                new JProperty("user_Level", user_Level),
                new JProperty("user_Status", user_Status),
                new JProperty("createDate", user_Createdate),
                new JProperty("dateModify", user_DateModify),
                new JProperty("user_Username", user_Username),
                new JProperty("user_Password", user_Password)
                );
            string DataString = Parameters.ToString();
            var    Response   = "";

            apt       = new ApiParameter();
            apt.Name  = "Json";
            apt.Value = DataString;
            lapt.Add(apt);

            string PostUrl  = Url + "?";
            string PostBody = "";

            foreach (var p in lapt)
            {
                if (p.Name == "Json")
                {
                    PostBody += p.Value;
                }
                else
                {
                    PostUrl += p.Name + "=" + p.Value + "&";
                }
            }
            PostUrl = PostUrl.Remove(PostUrl.Length - 1);
            client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
            client.Encoding = Encoding.UTF8;
            Response        = client.UploadString(PostUrl, "POST", PostBody);
            return(Ok(Response));
        }
Example #24
0
        static string ParamDec(string name, ApiParameter param)
        {
            var sb      = new StringBuilder();
            var clrType = param.ClrType;

            sb.Append(PrettyPrintType(clrType));
            sb.Append(' ');
            sb.Append(name);

            if (!param.Required)
            {
                sb.Append(" = null");
            }

            return(sb.ToString());
        }
Example #25
0
        public static ApiParameterBuildOutput FromModel(ApiParameter model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new ApiParameterBuildOutput
            {
                Name = model.Name,
                Type = new ApiTypeAndSpec {
                    Uid = model.Type
                },
                Description = model.Description,
            });
        }
Example #26
0
        private static void PrintDialogInteger(ApiParameter parameter, ref uint value)
        {
            ApiRecord record;

            record = ApiInfo.Instance[parameter];

            Console.Clear();
            Console.WriteLine($"{record.Min} <= value <= {record.Max}\ncurrent: {value}\n");
            Console.WriteLine($"Please enter the desired '{record.DisplayName}':");
            Console.WriteLine();

            while (!uint.TryParse(Console.ReadLine(), out value) || value < record.Min || value > record.Max)
            {
                //
            }
        }
Example #27
0
        private static void PrintDialogFloat(ApiParameter parameter, ref double value, double min, double max, string unit)
        {
            ApiRecord record;

            record = ApiInfo.Instance[parameter];

            Console.Clear();
            Console.WriteLine($"{min:F2} <= value <= {max:F2} {unit}\ncurrent: {value:F2} {unit}\n");
            Console.WriteLine($"Please enter the desired '{record.DisplayName}':");
            Console.WriteLine();

            while (!double.TryParse(Console.ReadLine(), out value) || value < min || value > max)
            {
                //
            }
        }
Example #28
0
        public fmParameterEditor(ApiParameter parameter)
        {
            InitializeComponent();

            // Copy the passed in parameter to the internal one
            if (parameter == null)
            {
                EditedParameter = new ApiParameter();
            }
            else
            {
                EditedParameter = new ApiParameter {
                    Name = parameter.Name, UnencodedValue = parameter.UnencodedValue
                }
            };
        }
Example #29
0
        public async Task <ActionResult> ApiParaEdit(int paraID, int urlID)
        {
            using (ApiManaRepository rep = new ApiManaRepository())
            {
                var model = await rep.GetApiParaByParaIDAsync(urlID, paraID);

                if (model == null)
                {
                    model = new ApiParameter()
                    {
                        ApiUrlID = urlID, DataType = 1, IsNull = true, InOROutPut = 1
                    }
                }
                ;
                //数据类型
                var DataTypeList = new List <SelectListItem>();
                var datatype     = await codeRepo.GetCodesListAsync(ECodesTypeId.DataTypeByApiPara);

                var datatype2 = new SelectList(datatype, "Code", "Text");
                DataTypeList.AddRange(datatype2);
                ViewBag.DataTypeList = DataTypeList;
                //输入输出类型
                var InOrOutPutList = new List <SelectListItem>();
                InOrOutPutList.Add(new SelectListItem()
                {
                    Value = "1", Text = "输入参数", Selected = true
                });
                InOrOutPutList.Add(new SelectListItem()
                {
                    Value = "2", Text = "输出参数"
                });
                ViewBag.InOrOutPutList = InOrOutPutList;
                //允许NULL值
                var ISNULLList = new List <SelectListItem>();
                ISNULLList.Add(new SelectListItem()
                {
                    Value = "True", Text = "可空", Selected = true
                });
                ISNULLList.Add(new SelectListItem()
                {
                    Value = "False", Text = "不允许为空"
                });
                ViewBag.ISNULLList = ISNULLList;
                return(View(model));
            }
        }
        /// <summary>
        /// 表单转换为类
        /// </summary>
        /// <param name="request">请求数据</param>
        /// <param name="parameter">参数</param>
        /// <returns></returns>
        private object QueryFormToClass(HttpRequest request, ApiParameter parameter)
        {
            var targetType = parameter.Type;
            var instance   = Activator.CreateInstance(targetType);
            var setters    = ModelProperty.GetSetProperties(targetType);

            foreach (var setter in setters)
            {
                var value = request.GetValues(setter.Name).FirstOrDefault();
                if (value != null)
                {
                    var valueCast = Converter.Cast(value, setter.Info.PropertyType);
                    setter.SetValue(instance, valueCast);
                }
            }
            return(instance);
        }
Example #31
0
        public static ListParameters ProcessParameters(this ApiParameter apiParameters, IQueryCollection collection)
        {
            var parameters = new ListParameters
            {
                Filters     = collection.ToDictionary(),
                Orders      = apiParameters.OrderBy?.Split(','),
                Descending  = apiParameters.Descending,
                PageSize    = apiParameters.PageSize,
                CurrentPage = apiParameters.Page,
                Projection  = apiParameters.Project,
                Selections  = apiParameters.Fields?.Split(',') ?? new string[0],
                Exclusions  = apiParameters.Exclude?.Split(',') ?? new string[0],
                Expansions  = apiParameters.Expand?.Split(',') ?? new string[0]
            };

            return(parameters);
        }
        private static void AddToComplexTypesList(List<ComplexType> list, ApiParameter param)
        {
            if (param != null)
            {
                string typeName = param.TypeName ?? param.ValueTypeName;
                if (!list.Any(c => c.Name == typeName) && !param.IsSimple)
                {
                    Type type = _typeCache[typeName];
                    ComplexType ct = new ComplexType();
                    list.Add(ct);
                    ct.Name = type.FullName;
                    ct.Properties = new List<ApiParameter>();
                    PropertyInfo[] propertyInfos = type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
                    foreach (var pi in propertyInfos)
                    {
                        ApiParameter prop = MakeParameter(pi.PropertyType);
                        prop.Name = pi.Name;
                        ct.Properties.Add(prop);

                        AddToComplexTypesList(list, prop);
                    }
                }
            }
        }
        private static List<ComplexType> GetComplexTypes(ApiParameter param)
        {
            List<ComplexType> types = new List<ComplexType>();

            AddToComplexTypesList(types,param);

            return types;
        }
        private static ApiParameter MakeParameter(Type type)
        {
            Type actualType = type.ListedType() ?? type.DictionariedType() ?? type;
            actualType = Nullable.GetUnderlyingType(actualType) ?? actualType;
            _typeCache[actualType.FullName] = actualType;
            var p = new ApiParameter()
            {
                TypeName = actualType.FullName,
                IsDictionary = type.IsDictionary(),
                IsList = type.ListedType() != null,
                IsSimple = actualType.IsSimpleType()
            };

            if (p.IsDictionary)
            {
                p.TypeName = null;

                if (type.GenericTypeArguments.Length == 2)
                {
                    p.KeyTypeName = type.GenericTypeArguments[0].FullName;
                    p.ValueTypeName = type.GenericTypeArguments[1].FullName;
                }
            }

            return p;
        }