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


C# EdmVersion类代码示例

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


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

示例1: CsdlXElementComparer

        private void CsdlXElementComparer(IEnumerable<XElement> expectedCsdls, IEnumerable<XElement> actualCsdls, EdmVersion version)
        {
            var updatedExpectedCsdls = ModelBuilderHelpers.ReplaceCsdlNamespacesForEdmVersion(expectedCsdls.ToArray(), version);
            var updatedActualCsdls = ModelBuilderHelpers.ReplaceCsdlNamespacesForEdmVersion(actualCsdls.ToArray(), version);

            new ConstructiveApiCsdlXElementComparer().Compare(updatedExpectedCsdls.ToList(), updatedActualCsdls.ToList());
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:7,代码来源:ExpressionRoundTripTests.cs

示例2: InvalidEntitySetNameReference

        public static XElement[] InvalidEntitySetNameReference(EdmVersion edmVersion)
        {
            const string csdl =
@"<?xml version=""1.0"" encoding=""utf-16""?>
<Schema Namespace=""Bork"" Alias=""Self"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
  <EntityType Name=""Entity1"">
    <Key>
        <PropertyRef Name=""Id"" />
    </Key>
    <Property Name=""Id"" Type=""Int32"" Nullable=""false""/>
    <Property Name=""OtherId"" Type=""Int32"" />
    <NavigationProperty Name=""Navigation"" Type=""Bork.Entity2"" Nullable=""false"" Partner=""Navigation"" /> 
  </EntityType>
  <EntityType Name=""Entity2"">
    <Key>
        <PropertyRef Name=""Id"" />
    </Key>
    <Property Name=""Id"" Type=""Int32"" Nullable=""false""/>
    <Property Name=""OtherId"" Type=""Int32"" Nullable=""false""/> 
    <NavigationProperty Name=""Navigation"" Type=""Collection(Bork.Entity1)"" Partner=""Navigation"" /> 
  </EntityType>
  <EntityContainer Name=""Container"">
    <EntitySet Name=""Entity1_a"" EntityType=""Bork.Entity1"">
      <NavigationPropertyBinding Path=""Navigation"" Target=""Entity2_b"" />
    </EntitySet>
    <EntitySet Name=""Entity2_a"" EntityType=""Bork.Entity2"">
      <NavigationPropertyBinding Path=""Navigation"" Target=""Entity1_b"" />
    </EntitySet>
  </EntityContainer>
</Schema>";
            return FixUpWithEdmVersion(csdl, edmVersion);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:32,代码来源:ValidationTestModelBuilder.cs

示例3: Serialize

        /// <summary>
        /// Serializes the <paramref name="schema"/> in the specified <paramref name="csdlVersion"/> and returns it.
        /// </summary>
        /// <param name="csdlVersion">The CSDL version to use for serializing the entity model schema.</param>
        /// <param name="schema">The schema to serialize.</param>
        /// <returns>The serialized <paramref name="schema"/>.</returns>
        public IEnumerable<FileContents<XElement>> Serialize(EdmVersion csdlVersion, EntityModelSchema schema)
        {
            ExceptionUtilities.Assert(schema != null, "schema != null");

            // TODO: Can we inherit from the default implemenation of the CSDL content generator instead of doing this in a separate step?
            schema = this.ODataAnnotationConverter.ConvertToProductAnnotations(schema);
            return this.BaseEntityModelSchemaSerializer.Generate(csdlVersion, schema);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:14,代码来源:EntityModelSchemaSerializer.cs

示例4: ParserSimpleIdentifierTypeReferenceCsdlSchemaCompliantTest

 public void ParserSimpleIdentifierTypeReferenceCsdlSchemaCompliantTest()
 {
     var edmVersions = new EdmVersion[] { EdmVersion.V40 };
     foreach (var edmVersion in edmVersions)
     {
         this.BasicXsdValidationTestForParserInputCsdl(ValidationTestModelBuilder.ConcurrencyModeTypes(edmVersion), edmVersion);
         this.BasicXsdValidationTestForParserInputCsdl(ValidationTestModelBuilder.CollectionTypeTypeRefSimpleTypeCanHaveFacets(edmVersion), edmVersion);
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:9,代码来源:EdmLibCsdlSchemaCompliantTests.cs

示例5: ParserOpenTypeSupportCsdlSchemaCompliantTest

 public void ParserOpenTypeSupportCsdlSchemaCompliantTest()
 {
     var edmVersions = new EdmVersion[] { EdmVersion.V40 };
     foreach (var edmVersion in edmVersions)
     {
         this.BasicXsdValidationTestForParserInputCsdl(ValidationTestModelBuilder.OpenTypeSupportInV40(edmVersion), edmVersion);
         this.BasicXsdValidationTestForParserInputCsdl(ODataTestModelBuilder.ODataTestModelWithOpenType, edmVersion);
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:9,代码来源:EdmLibCsdlSchemaCompliantTests.cs

示例6: OperationsWithReturnTypeOfPrimitiveDataTypeSchemasEdm

        public static IEdmModel OperationsWithReturnTypeOfPrimitiveDataTypeSchemasEdm(EdmVersion edmVersion)
        {
            var model = new EdmModel();
            foreach (var function in OperationTestModelBuilder.EdmFunctionsWithReturnTypePrimitiveDataType(edmVersion))
            {
                model.AddElement(function);
            }

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

示例7: AllPrimitiveEdmTypes

        public static IEnumerable<IEdmPrimitiveTypeReference> AllPrimitiveEdmTypes(EdmVersion edmVersion, bool isNullable)
        {
            IEnumerable<IEdmPrimitiveTypeReference> primitiveTypes = AllNonSpatialPrimitiveEdmTypes(isNullable);
            if (edmVersion >= EdmVersion.V40)
            {
                primitiveTypes = primitiveTypes.Concat(AllSpatialEdmTypes(isNullable));
            }

            return primitiveTypes;
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:10,代码来源:ModelBuilder.cs

示例8: OperationsWith2ParametersSchemasEdm

        public static IEdmModel OperationsWith2ParametersSchemasEdm(EdmVersion edmVersion)
        {
            var model = new EdmModel();
            foreach (var operation in OperationTestModelBuilder.EdmOperationsWith2Parameters(edmVersion))
            {
                model.AddElement(operation);
            }

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

示例9: ParserComplexTypeWithBaseTypeAbstractCsdlSchemaCompliantTest

 public void ParserComplexTypeWithBaseTypeAbstractCsdlSchemaCompliantTest()
 {
     var edmVersions = new EdmVersion[] { EdmVersion.V40 };
     foreach (var edmVersion in edmVersions)
     {
         this.BasicXsdValidationTestForParserInputCsdl(ModelBuilder.ComplexTypeWithBaseType(edmVersion), edmVersion);
         this.BasicXsdValidationTestForParserInputCsdl(ValidationTestModelBuilder.ComplexTypeBaseTypeSupportInV11(edmVersion), edmVersion);
         this.BasicXsdValidationTestForParserInputCsdl(ValidationTestModelBuilder.EdmComplexTypeInvalidIsPolymorphic(edmVersion), edmVersion);
         this.BasicXsdValidationTestForParserInputCsdl(ValidationTestModelBuilder.ComplexTypeIsAbstractSupportInV40(edmVersion), edmVersion);
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:11,代码来源:EdmLibCsdlSchemaCompliantTests.cs

示例10: GetCsdlFullNamespace

 public static XNamespace GetCsdlFullNamespace(EdmVersion csdlVersion)
 {
     if (csdlVersion == EdmVersion.V40)
     {
         return EdmConstants.EdmOasisNamespace;
     }
     else
     {
         throw new ArgumentOutOfRangeException("CSDL Schema Version is not supported: " + csdlVersion.ToString());
     }
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:11,代码来源:EdmLibCsdlContentGenerator.cs

示例11: ReplaceCsdlNamespacesForEdmVersion

 public static IEnumerable<XElement> ReplaceCsdlNamespacesForEdmVersion(XElement[] csdls, EdmVersion edmVersion)
 {
     var edmNamespace = EdmLibCsdlContentGenerator.GetCsdlFullNamespace(edmVersion);
     for (int i = 0; i < csdls.Count(); ++i)
     {
         if (edmNamespace != csdls[i].Name.Namespace)
         {
             csdls[i] = XElement.Parse(csdls[i].ToString().Replace(csdls[i].Name.Namespace.NamespaceName, edmNamespace.NamespaceName));
         }
     }
     return csdls;
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:ModelBuilderHelpers.cs

示例12: GetEdmVersion

 public static EdmVersion GetEdmVersion(XNamespace edmNamespace)
 {
     var edmVersions = new EdmVersion[] { EdmVersion.V40 };
     foreach (var edmVersion in edmVersions)
     {
         if (GetCsdlFullNamespace(edmVersion) == edmNamespace)
         {
             return edmVersion;
         }
     }
     throw new ArgumentOutOfRangeException("The namespace is not a EDM namespace " + edmNamespace.NamespaceName);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:12,代码来源:EdmLibCsdlContentGenerator.cs

示例13: SystemNamespace

        public static XElement[] SystemNamespace(EdmVersion edmVersion)
        {
            const string csdl =
@"<?xml version=""1.0"" encoding=""utf-16""?>
<Schema Namespace=""Edm"" Alias=""Self"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
  <EntityType Name=""Clod"">
    <Key>
        <PropertyRef Name=""Id"" />
    </Key>
    <Property Name=""Id"" Type=""Int32"" Nullable=""false""/>
    <Property Name=""Bar"" Type=""Int32"" />
  </EntityType>
</Schema>";
            return FixUpWithEdmVersion(csdl, edmVersion);
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:15,代码来源:ValidationTestModelBuilder.cs

示例14: GenerateContentsWithoutDefinition

        private void GenerateContentsWithoutDefinition(EdmVersion edmVersion, IEdmModel definitionModel)
        {
            IEnumerable<EdmError> errors;
            var contentsWithoutDefinition = this.GetSerializerResult(definitionModel, edmVersion, out errors).Select(XElement.Parse);

            var stripTheseElements = new[] { "Term", "Annotations", "Annotation"};

            foreach (var contents in contentsWithoutDefinition)
            {
                contents.Descendants().Where(e => stripTheseElements.Contains(e.Name.LocalName)).Remove();

                string namespaceName = contents.Attribute("Namespace").Value;
                this.namespaceToContents.Add(namespaceName, contents);
            }
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:15,代码来源:VocabularyDefinitionCsdlGenerator.cs

示例15: ReplaceCsdlNamespaceForEdmVersion

 public static string ReplaceCsdlNamespaceForEdmVersion(string csdl, EdmVersion edmVersion)
 {
     var edmNamespace = EdmLibCsdlContentGenerator.GetCsdlFullNamespace(edmVersion);
     var xmlReader = XmlReader.Create(new StringReader(csdl));
     while (xmlReader.Read())
     {
         if (xmlReader.Name == "Schema")
         {
             break;
         }
     }
     if (xmlReader.EOF)
     {
         throw new ArgumentException("{0} is not a well formed CSDL.");
     }
     return csdl.Replace(xmlReader.NamespaceURI, edmNamespace.NamespaceName);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:17,代码来源:ModelBuilderHelpers.cs


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