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


C# Library.EdmAction类代码示例

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


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


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