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

C# Library.EdmFunction类代码示例

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

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



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

示例1: TryMatch_ReturnTrue_IfSameFunction

        public void TryMatch_ReturnTrue_IfSameFunction()
        {
            // Arrange
            IEdmEntityType returnType = new Mock<IEdmEntityType>().Object;
            EdmFunction function = new EdmFunction("NS", "Function", new EdmEntityTypeReference(returnType, isNullable: false));

            Dictionary<string, string> parameterValues = new Dictionary<string, string>()
            {
                { "Parameter1", "1" },
                { "Parameter2", "2" }
            };

            Dictionary<string, string> parameterMappings = new Dictionary<string, string>()
            {
                { "Parameter1", "{param1}" },
                { "Parameter2", "{param2}" }
            };

            BoundFunctionPathSegment segment = new BoundFunctionPathSegment(function, model: null, parameterValues: parameterValues);
            BoundFunctionPathSegmentTemplate template = new BoundFunctionPathSegmentTemplate(
                new BoundFunctionPathSegment(function, model: null, parameterValues: parameterMappings));

            // Act
            Dictionary<string, object> values = new Dictionary<string,object>();
            bool result = template.TryMatch(segment, values);

            // Assert
            Assert.True(result);
            Assert.Equal(2, values.Count);
            Assert.Equal("1", values["param1"]);
            Assert.Equal("2", values["param2"]);
        }
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:32,代码来源:BoundFunctionPathSegmentTemplateTest.cs


示例2: FunctionImportShouldProduceCorrectFullyQualifiedNameAndNotHaveParameters

 public void FunctionImportShouldProduceCorrectFullyQualifiedNameAndNotHaveParameters()
 {
     var function = new EdmFunction("d.s", "testFunction", EdmCoreModel.Instance.GetString(true));
     function.AddParameter("param1", EdmCoreModel.Instance.GetString(false));
     var functionImport = new EdmFunctionImport(new EdmEntityContainer("d.s", "container"), "testFunction", function);
     EdmUtil.FullyQualifiedName(functionImport).Should().Be("d.s.container/testFunction");
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:7,代码来源:EdmUtilTests.cs


示例3: MultipleSchemasWithDifferentNamespacesEdm

        public static IEdmModel MultipleSchemasWithDifferentNamespacesEdm()
        {
            var namespaces = new string[] 
                { 
                    "FindMethodsTestModelBuilder.MultipleSchemasWithDifferentNamespaces.first", 
                    "FindMethodsTestModelBuilder.MultipleSchemasWithDifferentNamespaces.second" 
                };

            var model = new EdmModel();
            foreach (var namespaceName in namespaces)
            {
                var entityType1 = new EdmEntityType(namespaceName, "validEntityType1");
                entityType1.AddKeys(entityType1.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
                var entityType2 = new EdmEntityType(namespaceName, "VALIDeNTITYtYPE2");
                entityType2.AddKeys(entityType2.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
                var entityType3 = new EdmEntityType(namespaceName, "VALIDeNTITYtYPE3");
                entityType3.AddKeys(entityType3.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));

                entityType1.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo {Name = "Mumble", Target = entityType2, TargetMultiplicity = EdmMultiplicity.Many});

                var complexType = new EdmComplexType(namespaceName, "ValidNameComplexType1");
                complexType.AddStructuralProperty("aPropertyOne", new EdmComplexTypeReference(complexType, false));
                model.AddElements(new IEdmSchemaElement[] { entityType1, entityType2, entityType3, complexType });

                var function1 = new EdmFunction(namespaceName, "ValidFunction1", EdmCoreModel.Instance.GetSingle(false)); 
                var function2 = new EdmFunction(namespaceName, "ValidFunction1", EdmCoreModel.Instance.GetSingle(false));
                function2.AddParameter("param1", new EdmEntityTypeReference(entityType1, false));
                var function3 = new EdmFunction(namespaceName, "ValidFunction1", EdmCoreModel.Instance.GetSingle(false));
                function3.AddParameter("param1", EdmCoreModel.Instance.GetSingle(false));

                model.AddElements(new IEdmSchemaElement[] {function1, function2, function3});
            }

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


示例4: OperationImportSegmentUnitTests

        public OperationImportSegmentUnitTests()
        {
            nullableIntType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Int32), true);
            nullableDecimalType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true);
            nullableBinaryType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true);
            nullableStringType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true);

            container = ModelBuildingHelpers.BuildValidEntityContainer();
            model = new EdmModel();
            model.AddElement(container);

            this.functionIntToInt = new EdmFunction("Name.Space", "Function", this.nullableIntType);
            this.functionIntToInt.AddParameter("Parameter1", this.nullableIntType);
            this.functionImportIntToInt = new EdmFunctionImport(this.container, "Function", this.functionIntToInt);

            this.functionDecimalToInt = new EdmFunction("Name.Space", "Function", this.nullableIntType);
            this.functionDecimalToInt.AddParameter("Parameter1", this.nullableDecimalType);
            this.functionImportDecimalToInt = new EdmFunctionImport(this.container, "Function", this.functionDecimalToInt);

            this.functionBinaryToInt = new EdmFunction("Name.Space", "Function", this.nullableIntType);
            this.functionBinaryToInt.AddParameter("Parameter1", this.nullableBinaryType);
            this.functionImportBinaryToInt = new EdmFunctionImport(this.container, "Function", this.functionBinaryToInt);

            this.functionIntToString = new EdmFunction("Name.Space", "Function", this.nullableStringType);
            this.functionIntToString.AddParameter("Parameter1", this.nullableIntType);
            this.functionImportIntToString = new EdmFunctionImport(this.container, "Function", this.functionIntToString);

            model.AddElement(functionIntToInt);
            model.AddElement(functionDecimalToInt);
            model.AddElement(functionBinaryToInt);
            model.AddElement(functionIntToString);
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:32,代码来源:OperationSegmentUnitTests.cs


示例5: GetEdmModel

        private IEdmModel GetEdmModel()
        {
            EdmModel model = new EdmModel();
            EdmEntityContainer container = new EdmEntityContainer("NS", "Name");
            model.AddElement(container);

            IEdmTypeReference returnType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Boolean, isNullable: false);
            IEdmTypeReference parameterType = EdmCoreModel.Instance.GetPrimitive(EdmPrimitiveTypeKind.Boolean, isNullable: false);

            container.AddFunctionImport(new EdmFunction("NS", "FunctionWithoutParams", returnType));

            var functionWithOneParam = new EdmFunction("NS", "FunctionWithOneParam", returnType);
            functionWithOneParam.AddParameter("Parameter", parameterType);
            container.AddFunctionImport(functionWithOneParam);

            var functionWithMultipleParams = new EdmFunction("NS", "FunctionWithMultipleParams", returnType);
            functionWithMultipleParams.AddParameter("Parameter1", parameterType);
            functionWithMultipleParams.AddParameter("Parameter2", parameterType);
            functionWithMultipleParams.AddParameter("Parameter3", parameterType);
            container.AddFunctionImport(functionWithMultipleParams);

            container.AddFunctionImport(new EdmFunction("NS", "FunctionWithOverloads", returnType));
            var functionWithOverloads2 = new EdmFunction("NS", "FunctionWithOverloads", returnType);
            functionWithOverloads2.AddParameter("Parameter", parameterType);
            container.AddFunctionImport(functionWithOverloads2);
            var functionWithOverloads3 = new EdmFunction("NS", "FunctionWithOverloads", returnType);
            functionWithOverloads3.AddParameter("Parameter1", parameterType);
            functionWithOverloads3.AddParameter("Parameter2", parameterType);
            functionWithOverloads3.AddParameter("Parameter3", parameterType);
            container.AddFunctionImport(functionWithOverloads3);

            return model;
        }
开发者ID:quentez,项目名称:aspnetwebstack,代码行数:33,代码来源:FunctionResolverTest.cs


示例6: EdmFunctionConstructorWithNullReturnTypeShouldNotThrow

 public void EdmFunctionConstructorWithNullReturnTypeShouldNotThrow()
 {
     var edmFunction = new EdmFunction(defaultNamespaceName, checkout, this.boolType);
     edmFunction.Namespace.Should().Be(defaultNamespaceName);
     edmFunction.Name.Should().Be(checkout);
     edmFunction.ReturnType.Should().Be(this.boolType);
     edmFunction.IsComposable.Should().BeFalse();
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:8,代码来源:EdmFunctionTests.cs


示例7: EnsureFunctionImportIsAddedAndWithCorrectSuppliedName

        public void EnsureFunctionImportIsAddedAndWithCorrectSuppliedName()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmFunction function = new EdmFunction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var functionImport = container.AddFunctionImport("OtherName", function);

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


示例8: EdmFunctionConstructorShouldDefaultNonSpecifiedPropertiesCorrectly

 public void EdmFunctionConstructorShouldDefaultNonSpecifiedPropertiesCorrectly()
 {
     var edmFunction = new EdmFunction(defaultNamespaceName, checkout, this.boolType);
     edmFunction.Namespace.Should().Be(defaultNamespaceName);
     edmFunction.Name.Should().Be(checkout);
     edmFunction.ReturnType.Should().Be(this.boolType);
     edmFunction.EntitySetPath.Should().BeNull();
     edmFunction.IsBound.Should().BeFalse();
     edmFunction.SchemaElementKind.Should().Be(EdmSchemaElementKind.Function);
     edmFunction.IsComposable.Should().BeFalse();
 }
开发者ID:rossjempson,项目名称:odata.net,代码行数:11,代码来源:EdmFunctionTests.cs


示例9: DuplicateFunctionOverloadsWithDifferentBindingTypesAndSameNameWithDifferentReturnTypesShouldNotError

        public void DuplicateFunctionOverloadsWithDifferentBindingTypesAndSameNameWithDifferentReturnTypesShouldNotError()
        {
            var edmFunction = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetString(true), true /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            edmFunction.AddParameter("bindingParameter", EdmCoreModel.Instance.GetInt16(true));
            var edmFunction2 = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetInt16(true), true /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            edmFunction2.AddParameter("bindingParameter", EdmCoreModel.Instance.GetInt32(true));

            EdmModel model = new EdmModel();
            model.AddElement(edmFunction);
            model.AddElement(edmFunction2);
            ValidateNoError(model);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:12,代码来源:DuplicateOperationValidatorTests.cs


示例10: DuplicateUnBoundFunctionOverloadsSameParameterNamesShouldError

        public void DuplicateUnBoundFunctionOverloadsSameParameterNamesShouldError()
        {
            var edmFunction = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetString(true), false /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            edmFunction.AddParameter("bindingParameter1", EdmCoreModel.Instance.GetInt16(true));
            var edmFunction2 = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetInt16(true), false /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            edmFunction2.AddParameter("bindingParameter1", EdmCoreModel.Instance.GetInt32(true));

            EdmModel model = new EdmModel();
            model.AddElement(edmFunction);
            model.AddElement(edmFunction2);
            ValidateError(model, EdmErrorCode.DuplicateFunctions, Strings.EdmModel_Validator_Semantic_ModelDuplicateUnBoundFunctionsParameterNames("n.s.GetStuff"));
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:12,代码来源:DuplicateOperationValidatorTests.cs


示例11: EnsureDuplicateTermAndFunctionReturnTrue

        public void EnsureDuplicateTermAndFunctionReturnTrue()
        {
            EdmModel model = new EdmModel();
            var edmFunction = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetString(true), false /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            model.AddElement(edmFunction);

            EdmModel otherModel = new EdmModel();
            var edmTerm = new EdmTerm("n.s", "GetStuff", EdmPrimitiveTypeKind.Int32);
            otherModel.AddElement(edmTerm);
            model.AddReferencedModel(otherModel);

            model.OperationOrNameExistsInReferencedModel(edmFunction, edmFunction.FullName()).Should().BeTrue();
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:13,代码来源:ValidationHelperTests.cs


示例12: EdmFunctionConstructorShouldHaveSpecifiedConstructorValues

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


示例13: EnsureNoDuplicateFoundForFunctionShouldReturnFalse

        public void EnsureNoDuplicateFoundForFunctionShouldReturnFalse()
        {
            EdmModel otherModel = new EdmModel();
            var entityType = new EdmEntityType("n.s", "GetStuff2");
            otherModel.AddElement(entityType);

            var edmFunction = new EdmFunction("n.s", "GetStuff", new EdmEntityTypeReference(entityType, false), false /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            EdmModel model = new EdmModel();
            model.AddElement(edmFunction);
            model.AddReferencedModel(otherModel);

            model.OperationOrNameExistsInReferencedModel(edmFunction, edmFunction.FullName()).Should().BeFalse();
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:13,代码来源:ValidationHelperTests.cs


示例14: EnsureDuplicateContainerFunctionReturnTrue

        public void EnsureDuplicateContainerFunctionReturnTrue()
        {
            EdmModel model = new EdmModel();
            var edmFunction = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetString(true), false /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            model.AddElement(edmFunction);

            EdmModel otherModel = new EdmModel();
            EdmEntityContainer container = new EdmEntityContainer("n.s", "GetStuff");
            otherModel.AddElement(container);
            model.AddReferencedModel(otherModel);

            model.OperationOrNameExistsInReferencedModel(edmFunction, edmFunction.FullName()).Should().BeTrue();
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:13,代码来源:ValidationHelperTests.cs


示例15: GetEdmType_Returns_FunctionReturnType

        public void GetEdmType_Returns_FunctionReturnType()
        {
            // Arrange
            IEdmEntityType returnType = new Mock<IEdmEntityType>().Object;
            EdmFunction function = new EdmFunction("NS", "Function", new EdmEntityTypeReference(returnType, isNullable: false));
            BoundFunctionPathSegment segment = new BoundFunctionPathSegment(function, model: null, parameterValues: null);

            // Act
            var result = segment.GetEdmType(returnType);

            // Assert
            Assert.Same(returnType, result);
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:13,代码来源:BoundFunctionPathSegmentTest.cs


示例16: 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


示例17: EdmFunction

        public void DuplicateFunctionsUnBoundFunctionsWithSameNameWhereBindingTypeDifferentonNullabilityAndSameParametersShouldError()
        {
            var edmFunction = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetString(true), true /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            edmFunction.AddParameter("bindingParameter", EdmCoreModel.Instance.GetInt16(true));
            edmFunction.AddParameter("differentName", EdmCoreModel.Instance.GetInt16(true));
            var edmFunction2 = new EdmFunction("n.s", "GetStuff", EdmCoreModel.Instance.GetString(true), true /*isBound*/, null /*entitySetPath*/, false /*isComposable*/);
            edmFunction2.AddParameter("bindingParameter", EdmCoreModel.Instance.GetInt16(true));
            edmFunction2.AddParameter("otherParameter", EdmCoreModel.Instance.GetInt16(false));

            EdmModel model = new EdmModel();
            model.AddElement(edmFunction);
            model.AddElement(edmFunction2);
            ValidateError(model, EdmErrorCode.DuplicateFunctions, Strings.EdmModel_Validator_Semantic_ModelDuplicateBoundFunctionParameterTypes("n.s.GetStuff"));
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:14,代码来源:DuplicateOperationValidatorTests.cs


示例18: MissingOperationGeneratorTests

        public MissingOperationGeneratorTests()
        {
            this.model = new EdmModel();
            this.container = new EdmEntityContainer("Fake", "Container");
            this.functionEdmMetadata = new EdmFunction("Fake", "FakeFunction", EdmCoreModel.Instance.GetInt32(false), true /*isBound*/, null, true /*isComposable*/);
            this.actionEdmMetadata = new EdmAction("Fake", "FakeAction", EdmCoreModel.Instance.GetInt32(false), true/*isBound*/, null /*entitySetPath*/);
            this.model.AddElement(this.container);
            this.model.AddElement(this.actionEdmMetadata);
            this.model.AddElement(this.functionEdmMetadata);

            this.allOperations = new EdmOperation[] { this.actionEdmMetadata, this.functionEdmMetadata };

            this.odataAction = new ODataAction {Metadata = new Uri("http://temp.org/$metadata#Fake.FakeAction")};
            this.odataFunction = new ODataFunction {Metadata = new Uri("http://temp.org/$metadata#Fake.FakeFunction")};
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:15,代码来源:MissingOperationGeneratorTests.cs


示例19: TestInitialize

        public void TestInitialize()
        {
            this.MetadataDocumentUri = new Uri("http://www.myhost.com/myservice.svc/$metadata");

            this.model = new EdmModel();

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

            this.cityType = new EdmEntityType("TestModel", "City");
            EdmStructuralProperty cityIdProperty = cityType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
            cityType.AddKeys(cityIdProperty);
            cityType.AddStructuralProperty("Name", EdmCoreModel.Instance.GetString(/*isNullable*/false));
            cityType.AddStructuralProperty("Size", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
            this.model.AddElement(cityType);

            EdmComplexType complexType = new EdmComplexType("TestModel", "MyComplexType");
            this.model.AddElement(complexType);

            this.operationWithNoOverload = new EdmFunction("TestModel", "FunctionImportWithNoOverload", EdmCoreModel.Instance.GetInt32(true));
            this.operationImportWithNoOverload = defaultContainer.AddFunctionImport("FunctionImportWithNoOverload", operationWithNoOverload);
            this.model.AddElement(operationWithNoOverload);

            this.operationWithOverloadAnd0Param = new EdmFunction("TestModel", "FunctionImportWithOverload", EdmCoreModel.Instance.GetInt32(true));
            this.operationImportWithOverloadAnd0Param = defaultContainer.AddFunctionImport("FunctionImportWithOverload", operationWithOverloadAnd0Param);

            this.operationWithOverloadAnd1Param = new EdmFunction("TestModel", "FunctionImportWithOverload", EdmCoreModel.Instance.GetInt32(true));
            this.operationWithOverloadAnd1Param.AddParameter("p1", EdmCoreModel.Instance.GetInt32(false));
            this.model.AddElement(operationWithOverloadAnd1Param);
            this.operationImportWithOverloadAnd1Param = defaultContainer.AddFunctionImport("FunctionImportWithOverload", operationWithOverloadAnd1Param);
            
            this.operationWithOverloadAnd2Params = new EdmFunction("TestModel", "FunctionImportWithOverload", EdmCoreModel.Instance.GetInt32(true));
            var cityTypeReference = new EdmEntityTypeReference(this.cityType, isNullable: false);
            this.operationWithOverloadAnd2Params.AddParameter("p1", cityTypeReference);
            this.operationWithOverloadAnd2Params.AddParameter("p2", EdmCoreModel.Instance.GetString(true));
            this.model.AddElement(operationWithOverloadAnd2Params);
            this.operationImportWithOverloadAnd2Params = defaultContainer.AddFunctionImport("FunctionImportWithOverload", operationWithOverloadAnd2Params);

            this.operationWithOverloadAnd5Params = new EdmFunction("TestModel", "FunctionImportWithOverload", EdmCoreModel.Instance.GetInt32(true));
            this.operationWithOverloadAnd5Params.AddParameter("p1", new EdmCollectionTypeReference(new EdmCollectionType(cityTypeReference)));
            this.operationWithOverloadAnd5Params.AddParameter("p2", new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(isNullable: false))));
            this.operationWithOverloadAnd5Params.AddParameter("p3", EdmCoreModel.Instance.GetString(isNullable: true));
            EdmComplexTypeReference complexTypeReference = new EdmComplexTypeReference(complexType, isNullable: false);
            this.operationWithOverloadAnd5Params.AddParameter("p4", complexTypeReference);
            this.operationWithOverloadAnd5Params.AddParameter("p5", new EdmCollectionTypeReference(new EdmCollectionType(complexTypeReference)));
            this.model.AddElement(operationWithOverloadAnd5Params);
            this.operationImportWithOverloadAnd5Params = defaultContainer.AddFunctionImport("FunctionImportWithOverload", operationWithOverloadAnd5Params);
        }
开发者ID:rossjempson,项目名称:odata.net,代码行数:48,代码来源:ODataJsonLightUtilsTests.cs


示例20: AddOperationWhileTypeHasSameNameButOneIsAction

        public void AddOperationWhileTypeHasSameNameButOneIsAction()
        {
            EdmModel model = new EdmModel();

            EdmComplexType c1 = new EdmComplexType("Ambiguous", "Binding");
            IEdmOperation o1 = new EdmFunction("Ambiguous", "Binding", EdmCoreModel.Instance.GetInt16(true));
            IEdmOperation o2 = new EdmAction("Ambiguous", "Binding", EdmCoreModel.Instance.GetInt16(true));
            IEdmOperation o3 = new EdmFunction("Ambiguous", "Binding", EdmCoreModel.Instance.GetInt16(true));

            model.AddElement(o1);
            Assert.AreEqual(1, model.FindOperations("Ambiguous.Binding").Count(), "First function was correctly added to operation group");
            model.AddElement(o2);
            Assert.AreEqual(2, model.FindOperations("Ambiguous.Binding").Count(), "Second function was correctly added to operation group");
            model.AddElement(c1);
            model.AddElement(o3);
            Assert.AreEqual(3, model.FindOperations("Ambiguous.Binding").Count(), "Third function was correctly added to operation group");

            Assert.AreEqual(c1, model.FindType("Ambiguous.Binding"), "Single item resolved");
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:19,代码来源:ConstructibleModelErrorCases.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Library.EdmModel类代码示例发布时间:2022-05-26
下一篇:
C# Library.EdmEntityType类代码示例发布时间: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