本文整理汇总了C#中Hl7.Fhir.Model.Resource类的典型用法代码示例。如果您正苦于以下问题:C# Resource类的具体用法?C# Resource怎么用?C# Resource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Resource类属于Hl7.Fhir.Model命名空间,在下文中一共展示了Resource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public Resource Create(Resource entry)
{
var resourceJson = FHIRbaseHelper.FhirResourceToJson(entry);
var resource = FHIRbase.Call("fhir.create")
.WithJsonb(resourceJson)
.Cast<string>();
return FHIRbaseHelper.JsonToFhirResource(resource);
}
示例2: TryValidate
public static bool TryValidate(Resource resource, ICollection<ValidationResult> validationResults=null)
{
if(resource == null) throw new ArgumentNullException("resource");
var results = validationResults ?? new List<ValidationResult>();
return Validator.TryValidateObject(resource, ValidationContextFactory.Create(resource, null), results, true);
}
示例3: Append
public static void Append(this Bundle bundle, Resource resource)
{
var entry = new Bundle.BundleEntryComponent();
entry.Resource = resource;
entry.Base = bundle.Base;
bundle.Entry.Add(entry);
}
示例4: CreateEntryForResource
private static Bundle.BundleEntryComponent CreateEntryForResource(Resource resource)
{
var entry = new Bundle.BundleEntryComponent();
entry.Resource = resource;
// entry.FullUrl = resource.ResourceIdentity().ToString();
entry.FullUrl = resource.ExtractKey().ToUriString();
return entry;
}
示例5: Append
public static void Append(this Bundle bundle, Bundle.HTTPVerb method, Resource resource)
{
Bundle.BundleEntryComponent entry = CreateEntryForResource(resource);
if (entry.Request == null) entry.Request = new Bundle.BundleEntryRequestComponent();
entry.Request.Method = method;
bundle.Entry.Add(entry);
}
示例6: CreateFromResource
internal static ResourceEntry CreateFromResource(Resource resource, Uri id, DateTimeOffset updated, string title = null)
{
var result = ResourceEntry.Create(resource);
initializeResourceEntry(result, id, updated, title);
result.Resource = resource;
return result;
}
示例7: put
private void put(IKey key, int level, Resource resource)
{
if (resource is DomainResource)
{
DomainResource d = resource as DomainResource;
put(key, level, d);
put(key, level + 1, d.Contained);
}
}
示例8: ConstructSelfLink
public static Uri ConstructSelfLink(string baseuri, Resource resource)
{
// you must assume the resource has a verion id, otherwise a selflink is not possible
string s = baseuri + "/" + resource.TypeName + "/" + resource.Id;
if (resource.HasVersionId)
{
s += "/_history/" + resource.VersionId;
}
return new Uri(s);
}
示例9: CreateDocument
public static BsonDocument CreateDocument(Resource resource)
{
if (resource != null)
{
string json = FhirSerializer.SerializeResourceToJson(resource);
return BsonDocument.Parse(json);
}
else
{
return new BsonDocument();
}
}
示例10: Create
public Resource Create(Resource resource)
{
var resourceJson = ResourceDataHelper.FhirResourceToJson(resource);
var createdResourceJson = _context
.Call(FhirSchema.Name, FhirSchema.Func.Create)
.WithJson(resourceJson)
.Cast<String>();
var createdResource = ResourceDataHelper.JsonToFhirResource(createdResourceJson);
return createdResource;
}
示例11: ResourceType
public static void ResourceType(IKey key, Resource resource)
{
if (resource == null)
throw Error.BadRequest("Request did not contain a body");
if (key.TypeName != resource.TypeName)
{
throw Error.BadRequest(
"Received a body with a '{0}' resource, which does not match the indicated collection '{1}' in the url.",
resource.TypeName, key.TypeName);
}
}
示例12: RemoveExtensions
// HACK: json extensions
// Since WGM Chicago, extensions in json have their url in the json-name.
// because MongoDB doesn't allow dots in the json-name, this hack will remove all extensions for now.
public static void RemoveExtensions(Resource resource)
{
if (resource is DomainResource)
{
DomainResource domain = (DomainResource)resource;
domain.Extension = null;
domain.ModifierExtension = null;
RemoveExtensionsFromElements(resource);
foreach (Resource r in domain.Contained)
{
Hack.RemoveExtensions(r);
}
}
}
示例13: Deserialize
public Resource Deserialize(Resource existing=null)
{
// If there's no a priori knowledge of the type of Resource we will encounter,
// we'll have to determine from the data itself.
var resourceTypeName = _reader.GetResourceTypeName();
var mapping = _inspector.FindClassMappingForResource(resourceTypeName);
if (mapping == null)
throw Error.Format("Asked to deserialize unknown resource '" + resourceTypeName + "'", _reader);
// Delegate the actual work to the ComplexTypeReader, since
// the serialization of Resources and ComplexTypes are virtually the same
var cplxReader = new ComplexTypeReader(_reader);
return (Resource)cplxReader.Deserialize(mapping, existing);
}
示例14: Interaction
private Interaction(Bundle.HTTPVerb method, IKey key, DateTimeOffset? when, Resource resource)
{
if (resource != null)
{
key.ApplyTo(resource);
}
else
{
this.Key = key;
}
this.Resource = resource;
this.Method = method;
this.When = when ?? DateTimeOffset.Now;
this.State = InteractionState.Undefined;
}
示例15: AgainstModel
public static OperationOutcome AgainstModel(Resource resource)
{
// Phase 1, validate against low-level rules built into the FHIR datatypes
/*
(!FhirValidator.TryValidate(entry.Resource, vresults, recurse: true))
{
foreach (var vresult in vresults)
result.Issue.Add(createValidationResult("[.NET validation] " + vresult.ErrorMessage, vresult.MemberNames));
}
//doc.Validate(SchemaCollection.ValidationSchemaSet,
// (source, args) => result.Issue.Add( createValidationResult("[XSD validation] " + args.Message,null))
//);
*/
throw new NotImplementedException();
}