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


C# IEdmModel.Validate方法代码示例

本文整理汇总了C#中IEdmModel.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.Validate方法的具体用法?C# IEdmModel.Validate怎么用?C# IEdmModel.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEdmModel的用法示例。


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

示例1: ValidateModel

 internal static void ValidateModel(IEdmModel model, Version edmSchemaVersion)
 {
     IEnumerable<EdmError> enumerable;
     ValidationRuleSet ruleSet = new ValidationRuleSet(ValidationRuleSet.GetEdmModelRuleSet(edmSchemaVersion).Except<ValidationRule>(excludedSchemaValidationRules).Concat<ValidationRule>(additionalSchemaValidationRules));
     model.Validate(ruleSet, out enumerable);
     if ((enumerable != null) && enumerable.Any<EdmError>())
     {
         StringBuilder builder = new StringBuilder();
         foreach (EdmError error in enumerable)
         {
             builder.AppendLine(error.ToString());
         }
         throw new DataServiceException(500, System.Data.Services.Strings.MetadataSerializer_ModelValidationErrors(builder.ToString()));
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:15,代码来源:MetadataSerializer.cs

示例2: ValidateModel

        /// <summary>
        /// Validates the given <paramref name="model"/>.
        /// </summary>
        /// <param name="model">The <see cref="IEdmModel"/> to check.</param>
        /// <param name="edmSchemaVersion">The EDM version to be used.</param>
        internal static void ValidateModel(IEdmModel model, Version edmSchemaVersion)
        {
            ValidationRuleSet ruleSet = ValidationRuleSet.GetEdmModelRuleSet(edmSchemaVersion);
            ValidationRuleSet ruleSetWithoutTypeNameChecks = new ValidationRuleSet(
                ruleSet.Except(excludedSchemaValidationRules).Concat(additionalSchemaValidationRules));

            IEnumerable<EdmError> validationErrors;
            model.Validate(ruleSetWithoutTypeNameChecks, out validationErrors);

            if (validationErrors != null && validationErrors.Any())
            {
                StringBuilder builder = new StringBuilder();
                foreach (EdmError validationError in validationErrors)
                {
                    builder.AppendLine(validationError.ToString());
                }

                throw new DataServiceException(500, Microsoft.OData.Service.Strings.MetadataSerializer_ModelValidationErrors(builder.ToString()));
            }
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:25,代码来源:MetadataSerializer.cs

示例3: BasicXsdValidationTestForSerializerOutputCsdl

 private void BasicXsdValidationTestForSerializerOutputCsdl(IEdmModel edmModel, EdmVersion edmVersion)
 {
     IEnumerable<EdmError> valiationErrors = null;
     edmModel.Validate(toProductVersionlookup[edmVersion], out valiationErrors);
     IEnumerable<XElement> csdls = null;
     IEnumerable<EdmError> actualSerializationErrors;
     csdls = this.GetSerializerResult(edmModel, edmVersion, out actualSerializationErrors).Select(n => XElement.Parse(n)).ToArray();
     if (actualSerializationErrors.Count() == 0)
     {
         var xsdErrors = this.GetXsdValidationResults(csdls, edmVersion);
         if (valiationErrors.Count() == 0)
         {
             Assert.AreEqual(xsdErrors.Count(), 0, "No symantic validation error should guarantee the XSD validation for the corresponding CSDLs.");
         }
         this.BasicXsdValidationTestForParserInputCsdl(csdls, edmVersion);
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:17,代码来源:EdmLibCsdlSchemaCompliantTests.cs

示例4: BasicValidationConsistencyTest

        private void BasicValidationConsistencyTest(IEdmModel model, EdmVersion version)
        {
            IEnumerable<EdmError> initialErrors = null;
            model.Validate(toProductVersionlookup[version], out initialErrors);

            IEnumerable<EdmError> resultingErrors = null;
            IEnumerable<string> csdls = this.GetSerializerResult(model, version, out resultingErrors);

            if (!resultingErrors.Any())
            {
                var resultingModel = this.GetParserResult(csdls);
                resultingModel.Validate(toProductVersionlookup[version], out resultingErrors);
            }

            Assert.IsFalse(initialErrors.Count() < resultingErrors.Count(), "More errors are generated after round trip.");
        }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:16,代码来源:EdmLibCsdlSchemaCompliantTests.cs

示例5: ValidateUsingEdmValidator

 private void ValidateUsingEdmValidator(IEdmModel model, ValidationRuleSet ruleSet, IEnumerable<EdmError> expectedErrors)
 {
     IEnumerable<EdmError> actualErrors;
     model.Validate(ruleSet, out actualErrors);
     this.CompareErrors(actualErrors, expectedErrors);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:6,代码来源:InterfaceCriticalTests.cs


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