当前位置: 首页>>代码示例>>C#>>正文


C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法代码示例

本文整理汇总了C#中RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法的典型用法代码示例。如果您正苦于以下问题:C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法的具体用法?C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields怎么用?C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RestClient的用法示例。


在下文中一共展示了RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            bool repeat = true;
            while (repeat)
            {

                var mainNameSpace = string.Empty;
                var folder = string.Empty;
                var userName = string.Empty;
                var passWord = string.Empty;
                string howManyEntities = string.Empty;
                int count = 0;
                string countEntities = "N";
                string[] yn = { "Y", "N", "y", "n" };
                bool limitEntities = false;

                ReadInputFromUser(ref userName, "Please enter your Clarizen Username");
                ReadInputFromUserSecretly(ref passWord, "Please enter your Clarizen Password");
                ReadInputFromUser(ref mainNameSpace, "Please enter a Main Namespace ");
                ReadInputFromUser(ref countEntities, "Parse all Clarizen Entities? Y/N ", yn);

                if (countEntities == "N" || countEntities == "n") limitEntities = true;
                if (limitEntities == true)
                {
                    ReadInputFromUser(ref howManyEntities, "How many Entities to parse?");
                    try
                    {
                        count = Convert.ToInt32(howManyEntities);
                    }
                    catch (FormatException e)
                    {
                        Console.WriteLine("Input string is not a sequence of digits.");
                    }
                    catch (OverflowException e)
                    {
                        Console.WriteLine("The number cannot fit in an Int32.");
                    }
                }

                //TODO add logic to test this is a correct drive/folder.
                ReadInputFromUser(ref folder, "Please enter the folder location to save your code files ");

                ///need to change your password.
                RestClient client = new RestClient(userName, passWord);

                Console.WriteLine("Fetching data from Clarizen...");
                if (client.ListEntities != null)
                {
                    int counting = 0;
                    foreach (string s in client.ListEntities)
                    {
                        counting++;
                        client.GetAllMetadataDescribeEntitiesAndGetAllFields(s);
                        Console.Write(".");
                        if (counting > count && limitEntities == true) break;
                    }
                    Console.WriteLine();
                }

                if (client.ConvertedMetadata != null)
                {

                    Console.WriteLine("Creating Classes...");
                    foreach (KeyValuePair<string, JToken> pair in client.ConvertedMetadataWithoutCustomFields)
                    {

                        Console.Write(".");
                        var gen = Prepare(pair.Value, pair.Key, folder, mainNameSpace);
                        if (gen == null) return;

                        try
                        {
                            gen.GenerateClasses();

                        }
                        catch (Exception ex)
                        {
                            Console.Write("Error writing class " + ex + pair.Key + " " + pair.Value);
                        }

                    }
                }

                Console.WriteLine();
                Console.Write("Finished! - code should be ready in folder " + folder + " ");
                Console.WriteLine();
                string go = string.Empty;
                ReadInputFromUser(ref go, "Continue? ");
                if (go == "Y" || go == "y")
                {
                    repeat = true;
                }
                else
                {
                    repeat = false;
                }

            }
        }
开发者ID:garfbradaz,项目名称:PlainClarizen,代码行数:99,代码来源:Program.cs


注:本文中的RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。