private static void CreateEdmx() { ContentType.TypeSystemRestarted -= new EventHandler(ContentType_TypeSystemRestarted); ContentType.TypeSystemRestarted += new EventHandler(ContentType_TypeSystemRestarted); var context = new SchemaGenerationContext(); CreateEntityTypes(context); _edmx = new Edmx { DataServices = new DataServices { DataServiceVersion = MetaGenerator.dataServiceVersion, Schemas = new[] { new Schema { EntityTypes = context.EntityTypes, ComplexTypes = context.ComplexTypes, EnumTypes = context.EnumTypes, Associations = context.Associations, EntityContainer = CreateEntityContainer(context) } } } }; var writer = new StringWriter(); _edmx.WriteXml(writer); _edmxXml = writer.GetStringBuilder().ToString(); writer = new StringWriter(); _edmx.WriteJson(writer); _edmxJson = writer.GetStringBuilder().ToString(); }
/// <inheritdoc /> protected override async Task WriteMetadataAsync(HttpContext httpContext, Edmx edmx) { string result; using (var writer = new StringWriter()) { edmx.WriteXml(writer); result = writer.GetStringBuilder().ToString(); } await WriteRawAsync(result, httpContext).ConfigureAwait(false); }