本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmModel.GetEdmxVersion方法的典型用法代码示例。如果您正苦于以下问题:C# EdmModel.GetEdmxVersion方法的具体用法?C# EdmModel.GetEdmxVersion怎么用?C# EdmModel.GetEdmxVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmModel
的用法示例。
在下文中一共展示了EdmModel.GetEdmxVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEdmModelCsdlSchemaWriter
private static EdmModelCsdlSchemaWriter CreateEdmModelCsdlSchemaWriter(out XmlWriter xmlWriter, out MemoryStream memoryStream)
{
memoryStream = new MemoryStream();
IEdmModel model = new EdmModel();
model.SetEdmxVersion(new Version(4, 0));
var namespaceAliasMappings = model.GetNamespaceAliases();
Version edmxVersion = model.GetEdmxVersion();
xmlWriter = XmlWriter.Create(memoryStream);
return new EdmModelCsdlSchemaWriter(model, namespaceAliasMappings, xmlWriter, edmxVersion);
}
示例2: VisitAndVerifyXml
internal void VisitAndVerifyXml(Action<EdmModelCsdlSerializationVisitor> testAction, string expected)
{
XmlWriter xmlWriter;
MemoryStream memStream;
IEdmModel model = new EdmModel();
model.SetEdmxVersion(new Version(4, 0));
Version edmxVersion = model.GetEdmxVersion();
memStream = new MemoryStream();
xmlWriter = XmlWriter.Create(memStream, new XmlWriterSettings(){ConformanceLevel = ConformanceLevel.Auto});
var visitor = new EdmModelCsdlSerializationVisitor(model, xmlWriter, edmxVersion);
testAction(visitor);
xmlWriter.Flush();
memStream.Seek(0, SeekOrigin.Begin);
StreamReader reader = new StreamReader(memStream);
// Remove extra xml header text as its not needed.
string result = reader.ReadToEnd().Replace(@"<?xml version=""1.0"" encoding=""utf-8""?>", string.Empty);
Assert.AreEqual(expected, result);
}