當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。