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


C# Instance.GetContext方法代码示例

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


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

示例1: CreatePaymentSummaryInstance

        static Instance CreatePaymentSummaryInstance()
        {
            // Sets default namespaces
            var instance = new Instance();

            // When an explicit member is added, check that the namespace for the domain has been set
            instance.CheckExplicitMemberDomainExists = true;

            // Set fact attribute nil=true when value is empty string
            //instance.FactsNillable = true;

            // Initialize to the correct framework, module, taxonomy
            // The content is NOT validated against taxonomy or module schema
            // set module
            instance.SchemaReference = new SchemaReference("simple", "http://sbr.gov.au/taxonomy/sbr_au_reports/ato/ps/ps_0003/ps.0003.lodge.request.02.00.report.xsd");

            // set taxonomy
            instance.TaxonomyVersion = "ps_0003";

            // "basic" namespaces
            // These are used for adding correct prefixes for different elements
            instance.SetDimensionNamespace("RprtPyType.02.05", "http://sbr.gov.au/dims/RprtPyType.02.05.dims");

            // Namespaces for actual reported values that belong to a domain (explicit members)
            instance.AddDomainNamespace("ps.0003.lodge.req.02.00", "http://sbr.gov.au/rprt/ato/ps/ps.0003.lodge.request.02.00.report");
            //instance.AddDomainNamespace("RprtPyType.02.05", "http://sbr.gov.au/dims/RprtPyType.02.05.dims");

            instance.AddDomainNamespace("dtyp.02.18", "http://sbr.gov.au/fdtn/sbr.02.18.dtyp");
            instance.AddDomainNamespace("dtyp.02.08", "http://sbr.gov.au/fdtn/sbr.02.08.dtyp");
            instance.AddDomainNamespace("tech.01.02", "http://sbr.gov.au/fdtn/sbr.01.02.tech");
            instance.AddDomainNamespace("pyde.02.01", "http://sbr.gov.au/icls/py/pyde/pyde.02.01.data");
            instance.AddDomainNamespace("pyde.02.05", "http://sbr.gov.au/icls/py/pyde/pyde.02.05.data");
            instance.AddDomainNamespace("pyin.02.00", "http://sbr.gov.au/icls/py/pyin/pyin.02.00.data");
            instance.AddDomainNamespace("lrla.02.01", "http://sbr.gov.au/icls/lr/lrla/lrla.02.01.data");
            instance.AddDomainNamespace("bafpr1.02.00", "http://sbr.gov.au/icls/baf/bafpr/bafpr1.02.00.data");
            instance.AddDomainNamespace("ps.0003.prv.02.00", "http://sbr.gov.au/rprt/ato/ps/ps.0003.private.02.00.module");
            instance.AddDomainNamespace("period1.02.01", "http://sbr.gov.au/comnmdle/comnmdle.perioddetails1.02.01.module");
            instance.AddDomainNamespace("rvctc2.02.11", "http://sbr.gov.au/icls/rvc/rvctc/rvctc2.02.11.data");
            instance.AddDomainNamespace("rvctc2.02.03", "http://sbr.gov.au/icls/rvc/rvctc/rvctc2.02.03.data");
            instance.AddDomainNamespace("crigi.02.00", "http://sbr.gov.au/icls/cri/crigi/crigi.02.00.data");
            instance.AddDomainNamespace("gfati.02.00", "http://sbr.gov.au/icls/gfa/gfati/gfati.02.00.data");
            instance.AddDomainNamespace("dtyp.02.13", "http://sbr.gov.au/fdtn/sbr.02.13.dtyp");
            instance.AddDomainNamespace("gfati.02.00", "http://sbr.gov.au/icls/gfa/gfati/gfati.02.00.data");
            instance.AddDomainNamespace("dtyp.02.03", "http://sbr.gov.au/fdtn/sbr.02.03.dtyp");
            instance.AddDomainNamespace("email1.02.00", "http://sbr.gov.au/comnmdle/comnmdle.electroniccontactelectronicmail1.02.00.module");
            instance.AddDomainNamespace("fax1.02.00", "http://sbr.gov.au/comnmdle/comnmdle.electroniccontactfacsimile1.02.00.module");
            instance.AddDomainNamespace("pyde.02.00", "http://sbr.gov.au/icls/py/pyde/pyde.02.00.data");
            instance.AddDomainNamespace("tech.01.03", "http://sbr.gov.au/fdtn/sbr.01.03.tech");
            instance.AddDomainNamespace("pyde.02.08", "http://sbr.gov.au/icls/py/pyde/pyde.02.08.data");
            instance.AddDomainNamespace("prsnunstrcnm1.02.01", "http://sbr.gov.au/comnmdle/comnmdle.personunstructuredname1.02.01.module");
            instance.AddDomainNamespace("lrla.02.00", "http://sbr.gov.au/icls/lr/lrla/lrla.02.00.data");
            instance.AddDomainNamespace("rvctc2.02.10", "http://sbr.gov.au/icls/rvc/rvctc/rvctc2.02.10.data");
            instance.AddDomainNamespace("rvctc2.02.00", "http://sbr.gov.au/icls/rvc/rvctc/rvctc2.02.00.data");
            instance.AddDomainNamespace("pyin.02.05", "http://sbr.gov.au/icls/py/pyin/pyin.02.05.data");
            instance.AddDomainNamespace("prsnstrcnm2.02.00", "http://sbr.gov.au/comnmdle/comnmdle.personstructuredname2.02.00.module");
            instance.AddDomainNamespace("rvctc2.02.02", "http://sbr.gov.au/icls/rvc/rvctc/rvctc2.02.02.data");
            instance.AddDomainNamespace("orgname1.02.00", "http://sbr.gov.au/comnmdle/comnmdle.organisationname1.02.00.module");
            instance.AddDomainNamespace("pyin.02.07", "http://sbr.gov.au/icls/py/pyin/pyin.02.07.data");
            instance.AddDomainNamespace("phone1.02.00", "http://sbr.gov.au/comnmdle/comnmdle.electroniccontacttelephone1.02.00.module");
            instance.AddDomainNamespace("address1.02.02", "http://sbr.gov.au/comnmdle/comnmdle.addressdetails1.02.02.module");
            instance.AddDomainNamespace("pyid.02.00", "http://sbr.gov.au/icls/py/pyid/pyid.02.00.data");
            instance.AddDomainNamespace("dtyp.02.04", "http://sbr.gov.au/fdtn/sbr.02.04.dtyp");
            instance.AddDomainNamespace("dtyp.02.16", "http://sbr.gov.au/fdtn/sbr.02.16.dtyp");
            instance.AddDomainNamespace("dtyp.02.06", "http://sbr.gov.au/fdtn/sbr.02.06.dtyp");
            instance.AddDomainNamespace("emsup.02.02", "http://sbr.gov.au/icls/em/emsup/emsup.02.02.data");

            // Add reporter and period
            // These will be reused across all contexts by default
            // Scheme or value are NOT validated
            instance.Entity = new Entity("http://www.ato.gov.au/abn", "14088411787");
            instance.Period = new Period(2012, 7, 1, 2013, 6, 30);

            // Any units that aren't used will be excluded during serialization
            // So it's safe to add extra units if needed
            instance.Units.Add("U1", "iso4217:AUD");

            // A scenario contains the dimensions and their values for a datapoint
            var rp_segment = new Segment();
            rp_segment.Instance = instance;

            // Dimensions and domains can be given with or without namespaces
            // The namespace prefixes are added internally if needed
            // Explicit member values DO NEED the prefix
            rp_segment.AddExplicitMember("ReportPartyTypeDimension", "RprtPyType.02.05:ReportingParty");

            // set context id
            var context = instance.GetContext(rp_segment);
            context.Id = "RP";

            var node = instance.AddFact(rp_segment, "orgname1.02.00:OrganisationNameDetails", "", "", "");
            node.AddFact(rp_segment, "pyde.02.00:OrganisationNameDetails.OrganisationalNameType.Code", "", "", "MN");
            node.AddFact(rp_segment, "pyde.02.00:OrganisationNameDetails.OrganisationalName.Text", "", "", "RP OrganisationalNameText");

            node = instance.AddFact(rp_segment, "orgname1.02.00:OrganisationNameDetails", "", "", "");
            node.AddFact(rp_segment, "pyde.02.00:OrganisationNameDetails.OrganisationalNameType.Code", "", "", "MTR");
            node.AddFact(rp_segment, "pyde.02.00:OrganisationNameDetails.OrganisationalName.Text", "", "", "RP OrganisationalTradeNameText");

            node = instance.AddFact(rp_segment, "prsnunstrcnm1.02.01:PersonUnstructuredName", "", "", "");
            node.AddFact(rp_segment, "pyde.02.05:PersonUnstructuredName.Usage.Code", "", "", "Contact");
            node.AddFact(rp_segment, "pyde.02.00:PersonUnstructuredName.FullName.Text", "", "", "RPPersonUnstructuredNameFullNameText");
//.........这里部分代码省略.........
开发者ID:dgm9704,项目名称:Xoxo,代码行数:101,代码来源:SBRInstanceTests.cs


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