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


C# Article.SaveAsync方法代码示例

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


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

示例1: SaveMultivaluedAsyncTest

        public async Task SaveMultivaluedAsyncTest()
        {
            var array = new[] { 1, 3, 4, 5, 6, 7 };
            var obj = new Article("object");
            obj.SetList<int>("multifield", array);
            await obj.SaveAsync();

            var saved = await Articles.GetAsync("object", obj.Id);
            var array2 = saved.GetList<int>("multifield");
            Assert.IsTrue(array.Intersect(array2).Count() == array.Length);
        }
开发者ID:neilunadkat,项目名称:appacitive-dotnet-sdk,代码行数:11,代码来源:MultiValuedFixture.cs

示例2: CreateArticleAsyncTest

 public async Task CreateArticleAsyncTest()
 {
     dynamic obj = new Article("object");
     obj.intfield = 1;
     obj.decimalfield = 22m / 7m;
     await obj.SaveAsync();
     var saved = obj as Article;
     Assert.IsNotNull(saved);
     Assert.IsTrue(string.IsNullOrWhiteSpace(saved.Id) == false);
     Console.WriteLine("Created article with id {0}.", saved.Id);
 }
开发者ID:beer-bahadur,项目名称:appacitive-dotnet-sdk,代码行数:11,代码来源:ArticleFixture.cs

示例3: MultiValueArticleTest

        public async Task MultiValueArticleTest()
        {
            var obj = new Article("object");
            obj.SetList<string>("multifield", new[] { "1", "2", "3", "4" });
            await obj.SaveAsync();

            var read = await Articles.GetAsync("object", obj.Id);
            var value = read.GetList<string>("multifield");
            var strList = read.GetList<string>("multifield");
            var intList = read.GetList<int>("multifield");
        }
开发者ID:neilunadkat,项目名称:appacitive-dotnet-sdk,代码行数:11,代码来源:ArticleFixture.cs

示例4: FindAndDisplayAllArticlesTest

 public async Task FindAndDisplayAllArticlesTest()
 {
     var waitHandle = new ManualResetEvent(false);
     
     // Create the article
     dynamic obj = new Article("object");
     obj.stringfield = Unique.String;
     await obj.SaveAsync();
     var saved = obj as Article;
     Console.WriteLine("Created articled with id {0}", saved.Id);
     var index = 1;
     // Search
     var articles = await Article.FindAllAsync("object", Query.None, Article.AllFields, 1, 100);
     do
     {
         articles.ForEach(a => Console.WriteLine("{0}) {1}", index++, a.Id));
         Console.WriteLine("page:{0} pageSize:{1} total: {2}", articles.PageNumber, articles.PageSize, articles.TotalRecords);
         if (articles.IsLastPage == false)
             articles = await articles.NextPageAsync();
         else
             break;
     } while (true);
     Console.WriteLine("Finished.");
 }
开发者ID:beer-bahadur,项目名称:appacitive-dotnet-sdk,代码行数:24,代码来源:ArticleFixture.cs


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