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


C# CouchbaseClient.GetJson方法代码示例

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


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

示例1: GetBeer

 /// <summary>
 /// Retrieve the beer object by name
 /// </summary>
 /// <param name="beerName"></param>
 /// <returns></returns>
 public Beer GetBeer(string beerName)
 {
     using (CouchbaseClient client = new CouchbaseClient())
     {
         Beer beer = client.GetJson<Beer>(beerName);
         return beer;
     }
 }
开发者ID:volkanx,项目名称:BeerExplorer,代码行数:13,代码来源:BeerRepository.cs

示例2: GetBrewery

 /// <summary>
 /// Retrieve the brewery object by key
 /// </summary>
 /// <param name="breweryId"></param>
 /// <returns></returns>
 public Brewery GetBrewery(string breweryId)
 {
     using (CouchbaseClient client = new CouchbaseClient())
     {
         Brewery brewery = client.GetJson<Brewery>(breweryId);
         return brewery;
     }
 }
开发者ID:volkanx,项目名称:BeerExplorer,代码行数:13,代码来源:BreweryRepository.cs

示例3: Run

        public override void Run()
        {
            var config = new CouchbaseClientConfiguration();
            config.Urls.Add(new Uri("http://localhost:8091/pools/"));
            config.Bucket = "default";

            var client = new CouchbaseClient(config);

            //Store JSON
            client.StoreJson(StoreMode.Set, "CT_Hartford", new City { Name = "Hartford", State = "CT" });

            //Get City instance back from JSON
            var city = client.GetJson<City>("CT_Hartford");
            Console.WriteLine(city.Name);

            client.Remove("CT_Hartford");
        }
开发者ID:piczmar,项目名称:couchbase_33degree,代码行数:17,代码来源:03_JSONStorage.cs

示例4: GetBreweryList

        /// <summary>
        /// Get all breweries from view
        /// </summary>
        /// <returns></returns>
        public IList<Brewery> GetBreweryList()
        {
            List<Brewery> resultSet = new List<Brewery>();
            Brewery brewery = null;

            using (CouchbaseClient client = new CouchbaseClient())
            {
                var view = client.GetView("beer", "brewery");

                foreach (var row in view)
                {
                    brewery = client.GetJson<Brewery>(row.ItemId);
                    resultSet.Add(brewery);
                }
            }

            return resultSet;
        }
开发者ID:volkanx,项目名称:BeerExplorer,代码行数:22,代码来源:BreweryRepository.cs

示例5: GetBeerByBrewery

        /// <summary>
        /// Get a list of beers brewed by a specific brewery
        /// </summary>
        /// <param name="breweryName"></param>
        /// <returns></returns>
        public IList<Beer> GetBeerByBrewery(string breweryId)
        {
            List<Beer> resultSet = new List<Beer>();
            Beer beer = null;

            using (CouchbaseClient client = new CouchbaseClient())
            {
                var view = client.GetView("beer", "by_brewery_id")
                                 .StartKey<string>(breweryId)
                                 .EndKey<string>(breweryId);

                foreach (var row in view)
                {
                    beer = client.GetJson<Beer>(row.ItemId);
                    resultSet.Add(beer);
                }
            }

            return resultSet;
        }
开发者ID:volkanx,项目名称:BeerExplorer,代码行数:25,代码来源:BeerRepository.cs


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