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


C# Bundle.GetBundleType方法代码示例

本文整理汇总了C#中Hl7.Fhir.Model.Bundle.GetBundleType方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.GetBundleType方法的具体用法?C# Bundle.GetBundleType怎么用?C# Bundle.GetBundleType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hl7.Fhir.Model.Bundle的用法示例。


在下文中一共展示了Bundle.GetBundleType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BundleTypeHandling

        public void BundleTypeHandling()
        {
            Bundle b = new Bundle();

            Assert.IsTrue(b.GetBundleType() == BundleType.Unspecified);

            b.SetBundleType(BundleType.Message);
            Assert.AreEqual(BundleType.Message, b.GetBundleType());
            Assert.AreEqual(1,b.Tags.Count());

            b.SetBundleType(BundleType.Document);
            Assert.AreEqual(BundleType.Document, b.GetBundleType());
            Assert.AreEqual(1, b.Tags.Count());

            b.SetBundleType(BundleType.Unspecified);
            Assert.AreEqual(0, b.Tags.Count());
        }
开发者ID:tiloc,项目名称:fhir-net-api,代码行数:17,代码来源:TagExtensionsTest.cs

示例2: Mailbox

        public Bundle Mailbox(Bundle bundle, Binary body)
        {
            // todo: this is not DSTU-1 conformant. 
            if(bundle == null || body == null) throw new SparkException("Mailbox requires a Bundle body payload"); 
            // For the connectathon, this *must* be a document bundle
            if (bundle.GetBundleType() != BundleType.Document)
                throw new SparkException("Mailbox endpoint currently only accepts Document feeds");

            Bundle result = new Bundle("Transaction result from posting of Document " + bundle.Id, DateTimeOffset.Now);

            // Build a binary with the original body content (=the unparsed Document)
            var binaryEntry = new ResourceEntry<Binary>(new Uri("cid:" + Guid.NewGuid()), DateTimeOffset.Now, body);
            binaryEntry.SelfLink = new Uri("cid:" + Guid.NewGuid());

            // Build a new DocumentReference based on the 1 composition in the bundle, referring to the binary
            var compositions = bundle.Entries.OfType<ResourceEntry<Composition>>();
            if (compositions.Count() != 1) throw new SparkException("Document feed should contain exactly 1 Composition resource");
            var composition = compositions.First().Resource;
            var reference = ConnectathonDocumentScenario.DocumentToDocumentReference(composition, bundle, body, binaryEntry.SelfLink);

            // Start by copying the original entries to the transaction, minus the Composition
            List<BundleEntry> entriesToInclude = new List<BundleEntry>();

            //TODO: Only include stuff referenced by DocumentReference
            //if(reference.Subject != null) entriesToInclude.AddRange(bundle.Entries.ById(new Uri(reference.Subject.Reference)));
            //if (reference.Author != null) entriesToInclude.AddRange(
            //         reference.Author.Select(auth => bundle.Entries.ById(auth.Id)).Where(be => be != null));
            //reference.Subject = composition.Subject;
            //reference.Author = new List<ResourceReference>(composition.Author);
            //reference.Custodian = composition.Custodian;

            foreach (var entry in bundle.Entries.Where(be => !(be is ResourceEntry<Composition>)))
                result.Entries.Add(entry);

            // Now add the newly constructed DocumentReference and the Binary
            result.Entries.Add(new ResourceEntry<DocumentReference>(new Uri("cid:" + Guid.NewGuid()), DateTimeOffset.Now, reference));
            result.Entries.Add(binaryEntry);

            // Process the constructed bundle as a Transaction and return the result
            return Transaction(result);
        }
开发者ID:TonyAbell,项目名称:spark,代码行数:41,代码来源:FhirService.cs


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