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


C# MetaModel.GetAttributeDefinition方法代码示例

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


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

示例1: GetSingleAssetTest

        public void GetSingleAssetTest()
        {
            IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
            IServices services = new Services(
                metaModel,
                new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));

            var memberId = Oid.FromToken("Member:20", metaModel);
            var query = new Query(memberId);
            var nameAttribute = metaModel.GetAttributeDefinition("Member.Name");
            var emailAttribute = metaModel.GetAttributeDefinition("Member.Email");

            query.Selection.Add(nameAttribute);
            query.Selection.Add(emailAttribute);
            var result = services.Retrieve(query);
            Asset member = result.Assets[0];

            Assert.IsNotNull(member);
            Assert.AreEqual("Administrator", member.GetAttribute(nameAttribute).Value);
            Assert.AreEqual("[email protected]", member.GetAttribute(emailAttribute).Value);
        }
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:21,代码来源:GettingStartedTests.cs

示例2: ReOpenAnAssetTest

        public void ReOpenAnAssetTest()
        {
            IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
            IServices services = new Services(
                metaModel,
                new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));

            // create a new story
            var projectId = Oid.FromToken("Scope:0", metaModel);
            var assetType = metaModel.GetAssetType("Story");
            var story = services.New(assetType, projectId);
            var nameAttribute = assetType.GetAttributeDefinition("Name");
            story.SetAttributeValue(nameAttribute, "My New Story");
            services.Save(story);

            // closes the story
            var closeOperation = metaModel.GetOperation("Story.Inactivate");
            var closeId = services.ExecuteOperation(closeOperation, story.Oid);

            //reopens the story
            var activateOperation = metaModel.GetOperation("Story.Reactivate");
            var activeId = services.ExecuteOperation(activateOperation, story.Oid);

            var query = new Query(activeId.Momentless);
            var assetState = metaModel.GetAttributeDefinition("Story.AssetState");
            query.Selection.Add(assetState);
            var result = services.Retrieve(query);
            Asset activeStory = result.Assets[0];

            Assert.AreEqual("Active", activeStory.GetAttribute(assetState).Value.ToString());
        }
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:31,代码来源:GettingStartedTests.cs

示例3: full_working_example_with_basic_authentication

        public void full_working_example_with_basic_authentication()
        {
            // Setting up a basic connection with the connector and retrieving the Member with the ID 20
            var dataConnector = new VersionOneAPIConnector(_prefix + "rest-1.v1/")
                .WithVersionOneUsernameAndPassword(_username, _password);
            var metaConnector = new VersionOneAPIConnector(_prefix + "meta.v1/");

            IMetaModel metaModel = new MetaModel(metaConnector);
            IServices services = new Services(metaModel, dataConnector);

            var memberId = Oid.FromToken("Member:20", metaModel);
            var query = new Query(memberId);
            var memberName = metaModel.GetAttributeDefinition("Member.Name");
            query.Selection.Add(memberName);

            var result = services.Retrieve(query);
        }
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:17,代码来源:VersionOneAPIConnectorExamples.cs


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