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


C# Model.Resource类代码示例

本文整理汇总了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);
        }
开发者ID:tamizhvendan,项目名称:fhirbase-net,代码行数:9,代码来源:FHIRbaseApi.cs

示例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);
        }
开发者ID:nagyistoce,项目名称:kevinpeterson-fhir,代码行数:7,代码来源:ModelValidator.cs

示例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);
 }
开发者ID:raysearchlabs,项目名称:spark,代码行数:7,代码来源:BundleExtensions.cs

示例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;
        }
开发者ID:Condeti,项目名称:spark,代码行数:8,代码来源:BundleExtensions.cs

示例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);
        }
开发者ID:Condeti,项目名称:spark,代码行数:8,代码来源:BundleExtensions.cs

示例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;
        }
开发者ID:TonyAbell,项目名称:spark,代码行数:9,代码来源:BundleEntryFactory.cs

示例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);
     }
     
 }
开发者ID:Condeti,项目名称:spark,代码行数:10,代码来源:MongoIndexer.cs

示例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);
 }
开发者ID:raysearchlabs,项目名称:spark,代码行数:10,代码来源:BundleExtensions.cs

示例9: CreateDocument

 public static BsonDocument CreateDocument(Resource resource)
 {
     if (resource != null)
     {
         string json = FhirSerializer.SerializeResourceToJson(resource);
         return BsonDocument.Parse(json);
     }
     else
     {
         return new BsonDocument();
     }
 }
开发者ID:Condeti,项目名称:spark,代码行数:12,代码来源:BsonHelper.cs

示例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;
        }
开发者ID:Netrika,项目名称:FhirbaseNet2,代码行数:13,代码来源:FhirbaseStore.cs

示例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);
            }

        }
开发者ID:Condeti,项目名称:spark,代码行数:13,代码来源:Validate.cs

示例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);
         }
     }
 }
开发者ID:Condeti,项目名称:spark,代码行数:17,代码来源:Hack.cs

示例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);
        }
开发者ID:tiloc,项目名称:fhir-net-api,代码行数:15,代码来源:ResourceReader.cs

示例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;
 }
开发者ID:Condeti,项目名称:spark,代码行数:15,代码来源:Interaction.cs

示例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();
        }
开发者ID:raysearchlabs,项目名称:spark,代码行数:17,代码来源:Validate.cs


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