本文整理汇总了C#中System.Uri.AddParam方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.AddParam方法的具体用法?C# Uri.AddParam怎么用?C# Uri.AddParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.AddParam方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildSnapshotPageLink
private Uri BuildSnapshotPageLink(Uri baseurl, string snapshotId, int snapshotIndex)
{
return baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshotId)
.AddParam(FhirParameter.SNAPSHOT_INDEX, snapshotIndex.ToString());
}
示例2: CreateSnapshot
public Snapshot CreateSnapshot(Uri selflink, IEnumerable<string> keys, SearchParams searchCommand)
{
string sort = GetFirstSort(searchCommand);
int? count = null;
if (searchCommand.Count.HasValue)
{
count = Math.Min(searchCommand.Count.Value, MAX_PAGE_SIZE);
selflink = selflink.AddParam(SearchParams.SEARCH_PARAM_COUNT, new string[] {count.ToString()});
}
if (string.IsNullOrEmpty(sort) == false)
{
selflink = selflink.AddParam(SearchParams.SEARCH_PARAM_SORT, new string[] {sort });
}
if (searchCommand.Include.Any())
{
selflink = selflink.AddParam(SearchParams.SEARCH_PARAM_INCLUDE, searchCommand.Include.ToArray());
}
return CreateSnapshot(Bundle.BundleType.Searchset, selflink, keys, sort, count, searchCommand.Include);
}
示例3: Uri
// Given a set of version id's, go fetch a subset of them from the store and build a Bundle
/*private Bundle createBundle(Snapshot snapshot, int start, int count)
{
var entryVersionIds = snapshot.Keys.Skip(start).Take(count).ToList();
var pageContents = store.Get(entryVersionIds, snapshot.SortBy).ToList();
var bundle =
BundleEntryFactory.CreateBundleWithEntries(snapshot.FeedTitle, new Uri(snapshot.FeedSelfLink),
"Spark MatchBox Search Engine", null, pageContents);
if (snapshot.Count != Snapshot.NOCOUNT)
bundle.TotalResults = snapshot.Count;
else
bundle.TotalResults = null;
var total = snapshot.Keys.Count();
// If we need paging, add the paging links
if (total > count)
buildLinks(bundle, snapshot, start, count);
return bundle;
}
*/
private static void buildLinks(Bundle bundle, Snapshot snapshot, int start, int count)
{
var lastPage = snapshot.Count / count;
// http://spark.furore.com/fhir/_snapshot/
Uri baseurl = new Uri(Settings.Endpoint.ToString() + "/" + FhirRestOp.SNAPSHOT);
bundle.Links.SelfLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, start.ToString())
.AddParam(FhirParameter.COUNT, count.ToString());
// First
bundle.Links.FirstLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, "0");
// Last
bundle.Links.LastLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, (lastPage * count).ToString());
// Only do a Previous if we can go back
if (start > 0)
{
int prevIndex = start - count;
if (prevIndex < 0) prevIndex = 0;
bundle.Links.PreviousLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, prevIndex.ToString());
}
// Only do a Next if we can go forward
if (start + count < snapshot.Count)
{
int nextIndex = start + count;
bundle.Links.NextLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, nextIndex.ToString());
}
}
示例4: BuildLinks
void BuildLinks(Bundle bundle, Snapshot snapshot, int start, int count)
{
var lastPage = snapshot.Count / count;
Uri baseurl = new Uri(localhost.Base.ToString() + "/" + FhirRestOp.SNAPSHOT);
bundle.SelfLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, start.ToString())
.AddParam(FhirParameter.COUNT, count.ToString());
// First
bundle.FirstLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, "0");
// Last
bundle.LastLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, (lastPage * count).ToString());
// Only do a Previous if we can go back
if (start > 0)
{
int prevIndex = start - count;
if (prevIndex < 0) prevIndex = 0;
bundle.PreviousLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, prevIndex.ToString());
}
// Only do a Next if we can go forward
if (start + count < snapshot.Count)
{
int nextIndex = start + count;
bundle.NextLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshot.Id)
.AddParam(FhirParameter.SNAPSHOT_INDEX, nextIndex.ToString());
}
}
示例5: buildLinks
private static void buildLinks(Bundle bundle, string snapshotId, int index, int pageSize, int count)
{
var lastPage = count / pageSize;
// http://spark.furore.com/fhir/_snapshot/
Uri baseurl = new Uri(Settings.Endpoint.ToString() + "/" + FhirRestOp.SNAPSHOT);
bundle.Links.SelfLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshotId)
.AddParam(FhirParameter.SNAPSHOT_INDEX, index.ToString())
.AddParam(FhirParameter.COUNT, pageSize.ToString());
// First
bundle.Links.FirstLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshotId)
.AddParam(FhirParameter.SNAPSHOT_INDEX, "0");
// Last
bundle.Links.LastLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshotId)
.AddParam(FhirParameter.SNAPSHOT_INDEX, (lastPage * pageSize).ToString());
// Only do a Previous if we can go back
if (index > 0)
{
int prevIndex = index - pageSize;
if (prevIndex < 0) prevIndex = 0;
bundle.Links.PreviousLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshotId)
.AddParam(FhirParameter.SNAPSHOT_INDEX, prevIndex.ToString());
}
// Only do a Next if we can go forward
if (index + pageSize < count)
{
int nextIndex = index + pageSize;
bundle.Links.NextLink =
baseurl
.AddParam(FhirParameter.SNAPSHOT_ID, snapshotId)
.AddParam(FhirParameter.SNAPSHOT_INDEX, nextIndex.ToString());
}
}