本文整理汇总了C#中IEdmModel.SetEdmxVersion方法的典型用法代码示例。如果您正苦于以下问题:C# IEdmModel.SetEdmxVersion方法的具体用法?C# IEdmModel.SetEdmxVersion怎么用?C# IEdmModel.SetEdmxVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEdmModel
的用法示例。
在下文中一共展示了IEdmModel.SetEdmxVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFormatter
private MediaTypeFormatter GetFormatter(Type responseType, out IEdmModel model)
{
HttpConfiguration configuration = Request.GetConfiguration();
if (configuration == null)
{
throw Error.InvalidOperation(SRResources.RequestMustContainConfiguration);
}
MediaTypeFormatter odataFormatter = configuration.GetODataFormatter(out model);
if (odataFormatter == null)
{
throw Error.InvalidOperation(SRResources.NoODataFormatterForMetadata);
}
model.SetEdmxVersion(_defaultEdmxVersion);
model.SetDataServiceVersion(_defaultDataServiceVersion);
odataFormatter = odataFormatter.GetPerRequestFormatterInstance(responseType, Request, mediaType: null);
return odataFormatter;
}
示例2: TryParse
private bool TryParse(IEnumerable<IEdmModel> referencedModels, out IEdmModel model, out IEnumerable<EdmError> parsingErrors)
{
Version edmxVersion;
CsdlModel astModel;
TryParseEdmxFileToCsdlModel(out edmxVersion, out astModel);
if (!this.HasIntolerableError())
{
List<CsdlModel> referencedAstModels = this.LoadAndParseReferencedEdmxFiles(edmxVersion);
IEnumerable<EdmError> csdlErrors;
this.csdlParser.GetResult(out astModel, out csdlErrors);
if (csdlErrors != null)
{
this.errors.AddRange(csdlErrors.Except(this.errors));
}
if (!this.HasIntolerableError())
{
CsdlSemanticsModel tmp = new CsdlSemanticsModel(astModel, new CsdlSemanticsDirectValueAnnotationsManager(), referencedAstModels);
// add more referenced IEdmModels in addition to the above loaded CsdlModels.
tmp.AddToReferencedModels(referencedModels);
model = tmp;
Debug.Assert(edmxVersion != null, "edmxVersion != null");
model.SetEdmxVersion(edmxVersion);
}
else
{
model = null;
}
}
else
{
model = null;
}
parsingErrors = this.errors;
return !this.HasIntolerableError();
}