本文整理汇总了C#中IKey.HasVersionId方法的典型用法代码示例。如果您正苦于以下问题:C# IKey.HasVersionId方法的具体用法?C# IKey.HasVersionId怎么用?C# IKey.HasVersionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKey
的用法示例。
在下文中一共展示了IKey.HasVersionId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Key
public static void Key(IKey key)
{
if (key.HasResourceId())
{
Validate.ResourceId(key.ResourceId);
}
if (key.HasVersionId())
{
Validate.VersionId(key.VersionId);
}
if (!string.IsNullOrEmpty(key.TypeName))
{
Validate.TypeName(key.TypeName);
}
}
示例2: Update
/// <summary>
/// Updates a resource if it exist on the given id, or creates the resource if it is new.
/// If a VersionId is included a version specific update will be attempted.
/// </summary>
/// <returns>200 OK (on success)</returns>
public FhirResponse Update(IKey key, Resource resource)
{
if (key.HasVersionId())
{
return this.VersionSpecificUpdate(key, resource);
}
else
{
return this.Put(key, resource);
}
}
示例3: HasVersion
public static void HasVersion(IKey key)
{
if (key.HasVersionId())
{
Validate.VersionId(key.VersionId);
}
else
{
throw Error.BadRequest("The request should contain a version id.");
}
}
示例4: HasNoVersion
public static void HasNoVersion(IKey key)
{
if (key.HasVersionId())
{
throw Error.BadRequest("Resource should not contain a version.");
}
}
示例5: Get
//public Interaction Get(string primarykey)
//{
// IMongoQuery query = MonQ.Query.EQ(Field.PRIMARYKEY, primarykey);
// BsonDocument document = collection.FindOne(query);
// if (document != null)
// {
// Interaction entry = document.ToInteraction();
// return entry;
// }
// else
// {
// return null;
// }
//}
public Interaction Get(IKey key)
{
var clauses = new List<IMongoQuery>();
clauses.Add(MonQ.Query.EQ(Field.TYPENAME, key.TypeName));
clauses.Add(MonQ.Query.EQ(Field.RESOURCEID, key.ResourceId));
if (key.HasVersionId())
{
clauses.Add(MonQ.Query.EQ(Field.VERSIONID, key.VersionId));
}
else
{
clauses.Add(MonQ.Query.EQ(Field.STATE, Value.CURRENT));
}
IMongoQuery query = MonQ.Query.And(clauses);
BsonDocument document = collection.FindOne(query);
return document.ToInteraction();
}