• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Library.EdmAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmAction的典型用法代码示例。如果您正苦于以下问题:C# EdmAction类的具体用法?C# EdmAction怎么用?C# EdmAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EdmAction类属于Microsoft.OData.Edm.Library命名空间,在下文中一共展示了EdmAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VerifyNullableIsWrittenInChildReturnTypeElementForCollectionElementType

 public void VerifyNullableIsWrittenInChildReturnTypeElementForCollectionElementType()
 {
     var action = new EdmAction("Default.Namespace", "Checkout", EdmCoreModel.GetCollection(EdmCoreModel.Instance.GetString(isUnbounded: false, maxLength: 10, isUnicode: false, isNullable: false)));
     VisitAndVerifyXml(
         (visitor) => visitor.VisitSchemaElement(action),
         @"<Action Name=""Checkout""><ReturnType Type=""Collection(Edm.String)"" Nullable=""false"" MaxLength=""10"" Unicode=""false"" /></Action>");
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:7,代码来源:EdmModelCsdlSerializationVisitorTests.cs


示例2: VerifyNoReturnTypeElementIsWrittenWhenNoReturnTypeIsProvided

 public void VerifyNoReturnTypeElementIsWrittenWhenNoReturnTypeIsProvided()
 {
     var action = new EdmAction("Default.Namespace", "Checkout", null);
     VisitAndVerifyXml(
         (visitor) => visitor.VisitSchemaElement(action),
         @"<Action Name=""Checkout"" />");
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:7,代码来源:EdmModelCsdlSerializationVisitorTests.cs


示例3: VerifyPrimitiveReturnTypeDefinedInChildReturnTypeElement

 public void VerifyPrimitiveReturnTypeDefinedInChildReturnTypeElement()
 {
     var action = new EdmAction("Default.Namespace", "Checkout", EdmCoreModel.Instance.GetString(false));
     VisitAndVerifyXml(
         (visitor) => visitor.VisitSchemaElement(action),
         @"<Action Name=""Checkout""><ReturnType Type=""Edm.String"" Nullable=""false"" /></Action>");
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:7,代码来源:EdmModelCsdlSerializationVisitorTests.cs


示例4: EdmActionConstructorWithNullReturnTypeShouldNotThrow

 public void EdmActionConstructorWithNullReturnTypeShouldNotThrow()
 {
     var edmAction = new EdmAction(defaultNamespaceName, checkout, null);
     edmAction.Namespace.Should().Be(defaultNamespaceName);
     edmAction.Name.Should().Be(checkout);
     edmAction.ReturnType.Should().BeNull();
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:7,代码来源:EdmActionUnitTests.cs


示例5: ExtendModelAsync

        public Task ExtendModelAsync(
            ModelContext context,
            CancellationToken cancellationToken)
        {
            var model = context.Model;
            var entityContainer = model.EntityContainer as EdmEntityContainer;

            foreach (ActionMethodInfo actionInfo in this.ActionInfos)
            {
                var returnTypeReference = ConventionalActionProvider.GetReturnTypeReference(actionInfo.Method.ReturnType);
                var action = new EdmAction(entityContainer.Namespace, actionInfo.ActionName, returnTypeReference);

                foreach (ParameterInfo parameter in actionInfo.Method.GetParameters())
                {
                    EdmOperationParameter actionParam = new EdmOperationParameter(
                        action,
                        parameter.Name,
                        ConventionalActionProvider.GetTypeReference(parameter.ParameterType));

                    action.AddParameter(actionParam);
                }

                model.AddElement(action);

                if (!action.IsBound)
                {
                    EdmActionImport actionImport = new EdmActionImport(entityContainer, action.Name, action);
                    entityContainer.AddElement(actionImport);
                }
            }
            return Task.FromResult<object>(null);
        }
开发者ID:jeeshenlee,项目名称:RESTier,代码行数:32,代码来源:ConventionalActionProvider.cs


示例6: VerifyOperationParameterWritten

 public void VerifyOperationParameterWritten()
 {
     var action = new EdmAction("Default.Namespace", "Checkout", null);
     action.AddParameter("firstParameter", EdmCoreModel.Instance.GetSingle(true));
     VisitAndVerifyXml(
         (visitor) => visitor.VisitSchemaElement(action),
         @"<Action Name=""Checkout""><Parameter Name=""firstParameter"" Type=""Edm.Single"" /></Action>");
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:8,代码来源:EdmModelCsdlSerializationVisitorTests.cs


示例7: VerifyEntityReturnTypeDefinedInChildReturnTypeElement

 public void VerifyEntityReturnTypeDefinedInChildReturnTypeElement()
 {
     var entityType = new EdmEntityType("NS.ds", "EntityType");
     var action = new EdmAction("Default.Namespace", "Checkout", new EdmEntityTypeReference(entityType, false));
     VisitAndVerifyXml(
         (visitor) => visitor.VisitSchemaElement(action),
         @"<Action Name=""Checkout""><ReturnType Type=""NS.ds.EntityType"" Nullable=""false"" /></Action>");
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:8,代码来源:EdmModelCsdlSerializationVisitorTests.cs


示例8: ODataJsonLightParameterReaderTests

 public ODataJsonLightParameterReaderTests()
 {
     referencedModel = new EdmModel();
     referencedModel.Fixup();
     this.action = new EdmAction("FQ.NS", "ActionImport", null);
     referencedModel.AddElement(this.action);
     this.model = TestUtils.WrapReferencedModelsToMainModel("TestModel", "DefaultContainer", referencedModel);
 }
开发者ID:spawnadv,项目名称:msgraphodata.net,代码行数:8,代码来源:ODataJsonLightParameterReaderTests.cs


示例9: Init

 public void Init()
 {
     referencedModel = new EdmModel();
     referencedModel.Fixup();
     this.action = new EdmAction("FQ.NS", "ActionImport", null);
     referencedModel.AddElement(this.action);
     this.model = TestUtils.WrapReferencedModelsToMainModel("TestModel", "DefaultContainer", referencedModel);
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:8,代码来源:ParameterReaderTests.cs


示例10: EdmActionImportConstructorShouldDefaultNonSpecifiedPropertiesCorrectly

 public void EdmActionImportConstructorShouldDefaultNonSpecifiedPropertiesCorrectly()
 {
     var edmAction = new EdmAction("DefaultNamespace", "Checkout", this.boolType);
     var edmActionImport = new EdmActionImport(this.entityContainer, "CheckoutImport", edmAction, null);
     edmActionImport.Name.Should().Be("CheckoutImport");
     edmActionImport.EntitySet.Should().BeNull();
     edmActionImport.Container.Should().Be(this.entityContainer);
     edmActionImport.Action.Should().Be(edmAction);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:9,代码来源:EdmActionImportTests.cs


示例11: GetActionLinkBuilder_ReturnsDefaultActionLinkBuilder_IfNotSet

        public void GetActionLinkBuilder_ReturnsDefaultActionLinkBuilder_IfNotSet()
        {
            // Arrange
            IEdmModel model = new EdmModel();
            IEdmEntityContainer container = new EdmEntityContainer("NS", "Container");
            IEdmAction action = new EdmAction("NS", "Action", returnType: null);

            Assert.NotNull(model.GetActionLinkBuilder(action));
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:9,代码来源:EdmModelExtensionsTest.cs


示例12: CreateServiceEdmModel

        public static IEdmModel CreateServiceEdmModel(string ns)
        {
            EdmModel model = new EdmModel();
            var defaultContainer = new EdmEntityContainer(ns, "PerfInMemoryContainer");
            model.AddElement(defaultContainer);

            var personType = new EdmEntityType(ns, "Person");
            var personIdProperty = new EdmStructuralProperty(personType, "PersonID", EdmCoreModel.Instance.GetInt32(false));
            personType.AddProperty(personIdProperty);
            personType.AddKeys(new IEdmStructuralProperty[] { personIdProperty });
            personType.AddProperty(new EdmStructuralProperty(personType, "FirstName", EdmCoreModel.Instance.GetString(false)));
            personType.AddProperty(new EdmStructuralProperty(personType, "LastName", EdmCoreModel.Instance.GetString(false)));
            personType.AddProperty(new EdmStructuralProperty(personType, "MiddleName", EdmCoreModel.Instance.GetString(true)));
            personType.AddProperty(new EdmStructuralProperty(personType, "Age", EdmCoreModel.Instance.GetInt32(false)));
            model.AddElement(personType);

            var simplePersonSet = new EdmEntitySet(defaultContainer, "SimplePeopleSet", personType);
            defaultContainer.AddElement(simplePersonSet);

            var largetPersonSet = new EdmEntitySet(defaultContainer, "LargePeopleSet", personType);
            defaultContainer.AddElement(largetPersonSet);

            var addressType = new EdmComplexType(ns, "Address");
            addressType.AddProperty(new EdmStructuralProperty(addressType, "Street", EdmCoreModel.Instance.GetString(false)));
            addressType.AddProperty(new EdmStructuralProperty(addressType, "City", EdmCoreModel.Instance.GetString(false)));
            addressType.AddProperty(new EdmStructuralProperty(addressType, "PostalCode", EdmCoreModel.Instance.GetString(false)));
            model.AddElement(addressType);

            var companyType = new EdmEntityType(ns, "Company");
            var companyId = new EdmStructuralProperty(companyType, "CompanyID", EdmCoreModel.Instance.GetInt32(false));
            companyType.AddProperty(companyId);
            companyType.AddKeys(companyId);
            companyType.AddProperty(new EdmStructuralProperty(companyType, "Name", EdmCoreModel.Instance.GetString(true)));
            companyType.AddProperty(new EdmStructuralProperty(companyType, "Address", new EdmComplexTypeReference(addressType, true)));
            companyType.AddProperty(new EdmStructuralProperty(companyType, "Revenue", EdmCoreModel.Instance.GetInt32(false)));

            model.AddElement(companyType);

            var companySet = new EdmEntitySet(defaultContainer, "CompanySet", companyType);
            defaultContainer.AddElement(companySet);

            var companyEmployeeNavigation = companyType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo()
            {
                Name = "Employees",
                Target = personType,
                TargetMultiplicity = EdmMultiplicity.Many
            });
            companySet.AddNavigationTarget(companyEmployeeNavigation, largetPersonSet);

            // ResetDataSource
            var resetDataSourceAction = new EdmAction(ns, "ResetDataSource", null, false, null);
            model.AddElement(resetDataSourceAction);
            defaultContainer.AddActionImport(resetDataSourceAction);

            return model;
        }
开发者ID:TomDu,项目名称:odata.net,代码行数:56,代码来源:PerfServiceEdmModel.cs


示例13: EnsureActionImportIsAddedAndWithCorrectSuppliedName

        public void EnsureActionImportIsAddedAndWithCorrectSuppliedName()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmAction action = new EdmAction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var actionImport = container.AddActionImport("OtherName", action);

            actionImport.Action.Should().Be(action);
            actionImport.Name.Should().Be("OtherName");
            container.Elements.ToArray()[0].Should().Be(actionImport);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:10,代码来源:EdmEntityContainerTests.cs


示例14: EdmActionConstructorShouldDefaultNonSpecifiedPropertiesCorrectly

 public void EdmActionConstructorShouldDefaultNonSpecifiedPropertiesCorrectly()
 {
     var edmAction = new EdmAction(defaultNamespaceName, checkout, this.boolType);
     edmAction.Namespace.Should().Be(defaultNamespaceName);
     edmAction.Name.Should().Be(checkout);
     edmAction.ReturnType.Should().Be(this.boolType);
     edmAction.EntitySetPath.Should().BeNull();
     edmAction.IsBound.Should().BeFalse();
     edmAction.SchemaElementKind.Should().Be(EdmSchemaElementKind.Action);
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:10,代码来源:EdmActionUnitTests.cs


示例15: EdmActionConstructorShouldHaveSpecifiedConstructorValues

 public void EdmActionConstructorShouldHaveSpecifiedConstructorValues()
 {
     var entitySetPath = new EdmPathExpression("Param1/Nav");
     var edmAction = new EdmAction(defaultNamespaceName, checkout, this.boolType, true, entitySetPath);
     edmAction.AddParameter(new EdmOperationParameter(edmAction, "Param1", new EdmEntityTypeReference(personType, false)));
     edmAction.Namespace.Should().Be(defaultNamespaceName);
     edmAction.Name.Should().Be(checkout);
     edmAction.ReturnType.Should().Be(this.boolType);
     edmAction.EntitySetPath.Should().Be(entitySetPath);
     edmAction.IsBound.Should().BeTrue();
     edmAction.SchemaElementKind.Should().Be(EdmSchemaElementKind.Action);
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:12,代码来源:EdmActionUnitTests.cs


示例16: ODataSwaggerUtilitiesTest

        public ODataSwaggerUtilitiesTest()
        {
            CustomersModelWithInheritance model = new CustomersModelWithInheritance();
            _customer = model.Customer;
            _customers = model.Customers;

            IEdmAction action = new EdmAction("NS", "GetCustomers", null, false, null);
            _getCustomers = new EdmActionImport(model.Container, "GetCustomers", action);

            _isAnyUpgraded = model.Model.SchemaElements.OfType<IEdmFunction>().FirstOrDefault(e => e.Name == "IsAnyUpgraded");
            _isCustomerUpgradedWithParam = model.Model.SchemaElements.OfType<IEdmFunction>().FirstOrDefault(e => e.Name == "IsUpgradedWithParam");
        }
开发者ID:Gebov,项目名称:WebApi,代码行数:12,代码来源:ODataSwaggerUtilitiesTest.cs


示例17: EnsureActionImportIsAddedAndWithCorrectEntitySetExpression

        public void EnsureActionImportIsAddedAndWithCorrectEntitySetExpression()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmAction action = new EdmAction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var edmEntitySet = new EdmEntitySet(container, "EntitySet", new EdmEntityType("DS", "TestEntity"));
            var entitySetExpression = new EdmEntitySetReferenceExpression(edmEntitySet);
            var actionImport = container.AddActionImport("OtherName", action, entitySetExpression);

            actionImport.Action.Should().Be(action);
            actionImport.Name.Should().Be("OtherName");
            actionImport.EntitySet.Should().Be(entitySetExpression);
            container.Elements.ToArray()[0].Should().Be(actionImport);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:EdmEntityContainerTests.cs


示例18: EdmActionImportConstructorShouldHaveSpecifiedConstructorValues

 public void EdmActionImportConstructorShouldHaveSpecifiedConstructorValues()
 {
     var actionEntitySetPath = new EdmPathExpression("Param1/Nav");
     var edmAction = new EdmAction("DefaultNamespace", "Checkout", this.boolType, true, actionEntitySetPath);
     edmAction.AddParameter(new EdmOperationParameter(edmAction, "Param1", new EdmEntityTypeReference(personType, true)));
     
     var actionImportEntitySetPath = new EdmPathExpression("Param1/Nav2");
     var edmActionImport = new EdmActionImport(this.entityContainer, "checkoutImport", edmAction, actionImportEntitySetPath);
     edmActionImport.Name.Should().Be("checkoutImport");
     edmActionImport.Container.Should().Be(this.entityContainer);
     edmActionImport.EntitySet.Should().Be(actionImportEntitySetPath);
     edmActionImport.Action.Should().Be(edmAction);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:13,代码来源:EdmActionImportTests.cs


示例19: AmbigiousOperationBindingShouldReferToFirstOperationAlwaysWhenNotNull

 public void AmbigiousOperationBindingShouldReferToFirstOperationAlwaysWhenNotNull()
 {
     var action1 = new EdmAction("DS", "name", EdmCoreModel.Instance.GetBoolean(false));
     action1.AddParameter("param", EdmCoreModel.Instance.GetBoolean(false));
     var function = new EdmFunction("DS2", "name2", EdmCoreModel.Instance.GetBoolean(false), true, new EdmPathExpression("path1"), true);
     AmbiguousOperationBinding ambigiousOperationBinding = new AmbiguousOperationBinding(action1, function);
     ambigiousOperationBinding.Namespace.Should().Be("DS");
     ambigiousOperationBinding.Name.Should().Be("name");
     ambigiousOperationBinding.ReturnType.Should().BeNull();
     ambigiousOperationBinding.Parameters.Should().HaveCount(1);
     ambigiousOperationBinding.SchemaElementKind.Should().Be(EdmSchemaElementKind.Action);
     ambigiousOperationBinding.IsBound.Should().BeFalse();
     ambigiousOperationBinding.EntitySetPath.Should().BeNull();
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:14,代码来源:AmbiguousOperationBindingTests.cs


示例20: Initialize

        public void Initialize()
        {
            this.edmModel = new EdmModel();

            this.defaultContainer = new EdmEntityContainer("TestModel", "DefaultContainer");
            this.edmModel.AddElement(this.defaultContainer);

            this.townType = new EdmEntityType("TestModel", "Town");
            this.edmModel.AddElement(townType);
            EdmStructuralProperty townIdProperty = townType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
            townType.AddKeys(townIdProperty);
            townType.AddStructuralProperty("Name", EdmCoreModel.Instance.GetString(/*isNullable*/false));
            townType.AddStructuralProperty("Size", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));

            this.cityType = new EdmEntityType("TestModel", "City", this.townType);
            cityType.AddStructuralProperty("Photo", EdmCoreModel.Instance.GetStream(/*isNullable*/false));
            this.edmModel.AddElement(cityType);

            this.districtType = new EdmEntityType("TestModel", "District");
            EdmStructuralProperty districtIdProperty = districtType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
            districtType.AddKeys(districtIdProperty);
            districtType.AddStructuralProperty("Zip", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
            districtType.AddStructuralProperty("Thumbnail", EdmCoreModel.Instance.GetStream(/*isNullable*/false));
            this.edmModel.AddElement(districtType);

            cityType.AddBidirectionalNavigation(
                new EdmNavigationPropertyInfo { Name = "Districts", Target = districtType, TargetMultiplicity = EdmMultiplicity.Many },
                new EdmNavigationPropertyInfo { Name = "City", Target = cityType, TargetMultiplicity = EdmMultiplicity.One });

            this.defaultContainer.AddEntitySet("Cities", cityType);
            this.defaultContainer.AddEntitySet("Districts", districtType);

            this.metropolisType = new EdmEntityType("TestModel", "Metropolis", this.cityType);
            this.metropolisType.AddStructuralProperty("MetropolisStream", EdmCoreModel.Instance.GetStream(/*isNullable*/false));
            this.edmModel.AddElement(metropolisType);

            metropolisType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo { Name = "MetropolisNavigation", Target = districtType, TargetMultiplicity = EdmMultiplicity.ZeroOrOne });

            this.action = new EdmAction("TestModel", "Action", new EdmEntityTypeReference(this.cityType, true));
            this.action.AddParameter("Param", EdmCoreModel.Instance.GetInt32(false));
            this.edmModel.AddElement(action);
            this.actionImport = new EdmActionImport(this.defaultContainer, "Action", action);

            this.actionConflictingWithPropertyName = new EdmAction("TestModel", "Zip", new EdmEntityTypeReference(this.districtType, true));
            this.actionConflictingWithPropertyName.AddParameter("Param", EdmCoreModel.Instance.GetInt32(false));
            this.edmModel.AddElement(actionConflictingWithPropertyName);
            this.actionImportConflictingWithPropertyName = new EdmActionImport(this.defaultContainer, "Zip", actionConflictingWithPropertyName);

            this.openType = new EdmEntityType("TestModel", "OpenCity", this.cityType, false, true);
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:50,代码来源:SelectedPropertiesNodeTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Library.EdmCollectionTypeReference类代码示例发布时间:2022-05-26
下一篇:
C# Semantic.SelectExpandClause类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap