本文整理汇总了C#中Models.GetClient方法的典型用法代码示例。如果您正苦于以下问题:C# Models.GetClient方法的具体用法?C# Models.GetClient怎么用?C# Models.GetClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Models
的用法示例。
在下文中一共展示了Models.GetClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportCategoryData
public void ImportCategoryData(Models.Repository repository, IEnumerable<Models.Category> data)
{
var bucket = repository.GetClient();
////导入站点不用PersistTo
data.ForEach((it, index) =>
{
bucket.Store(StoreMode.Set, it.GetDocumentKey(), it.ToJson());
});
}
示例2: ExecuteQuery
/// <summary>
///
/// </summary>
/// <param name="repository"></param>
/// <param name="queryText">The query text is the name of view. Composite of "DesignName/ViewName" </param>
/// <param name="commandType"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public IEnumerable<IDictionary<string, object>> ExecuteQuery(Models.Repository repository, string queryText, System.Data.CommandType commandType = System.Data.CommandType.Text, params KeyValuePair<string, object>[] parameters)
{
if (string.IsNullOrEmpty(queryText))
{
throw new Exception("Parameter:queryText is Null Or Empty.");
}
string[] paras = queryText.Split('/');
if (paras.Length != 2)
{
throw new Exception("Parameter:queryText format is error.");
}
var client = repository.GetClient();
var view = client.GetView(paras[0], paras[1]);
List<Dictionary<string, object>> ret = new List<Dictionary<string, object>>();
foreach (var row in view)
{
var dict = row.Info["value"] as Dictionary<string, object>;
ret.Add(dict);
}
return ret;
}