本文整理汇总了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()));
}
}
示例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()));
}
}
示例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);
}
}
示例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.");
}
示例5: ValidateUsingEdmValidator
private void ValidateUsingEdmValidator(IEdmModel model, ValidationRuleSet ruleSet, IEnumerable<EdmError> expectedErrors)
{
IEnumerable<EdmError> actualErrors;
model.Validate(ruleSet, out actualErrors);
this.CompareErrors(actualErrors, expectedErrors);
}