/// <inheritdoc />
        protected override async Task WriteMetadataAsync(HttpContext httpContext, Edmx edmx)
        {
            var requestedModule = httpContext.Request.Query["module"].ToString().ToLowerInvariant();

            if (string.IsNullOrEmpty(requestedModule))
            {
                requestedModule = "classes";
            }

            var schema0 = new Schema(TypescriptGenerationContext.DisabledContentTypeNames);
            var context = new TypescriptGenerationContext();
            var schema1 = new TypescriptTypeCollectorVisitor(context).Visit(schema0);

            var writer = new StringWriter();

            switch (requestedModule)
            {
            case "enums":
                new TypescriptEnumsVisitor(context, writer).Visit(schema1);
                break;

            case "complextypes":
                new TypescriptComplexTypesVisitor(context, writer).Visit(schema1);
                break;

            case "contenttypes":
                new TypescriptClassesVisitor(context, writer).Visit(schema1);
                break;

            case "resources":
                ResourceWriter.WriteResourceClasses(writer);
                break;

            case "schemas":
                new TypescriptCtdVisitor(context, writer).Visit(schema1);
                break;

            case "fieldsettings":
                new TypescriptFieldSettingsVisitor(context, writer).Visit(schema1);
                break;

            default:
                throw new InvalidOperationException("Unknown module name: " + requestedModule
                                                    + ". Valid names: enums, complextypes, contenttypes, resources, schemas, fieldsettings.");
            }

            await httpContext.Response.WriteAsync(writer.GetStringBuilder().ToString());
        }
        protected virtual void WriteMetadata(TextWriter writer, string requestedModule)
        {
            var context = new TypescriptGenerationContext();
            var schema0 = new ContentRepository.Schema.Metadata.Schema(new[]
                                                                       { "Application", "ApplicationCacheFile", "FieldSettingContent", "JournalNode" });
            var schema1 = new TypescriptTypeCollectorVisitor(context).Visit(schema0);

            switch (requestedModule)
            {
            case "enums":
                new TypescriptEnumsVisitor(context, writer).Visit(schema1);
                break;

            case "complextypes":
                new TypescriptComplexTypesVisitor(context, writer).Visit(schema1);
                break;

            case "contenttypes":
                new TypescriptClassesVisitor(context, writer).Visit(schema1);
                break;

            case "resources":
                ResourceWriter.WriteResourceClasses(writer);
                break;

            case "schemas":
                new TypescriptCtdVisitor(context, writer).Visit(schema1);
                break;

            case "fieldsettings":
                new TypescriptFieldSettingsVisitor(context, writer).Visit(schema1);
                break;

            default:
                throw new InvalidOperationException(
                          $"Unknown module name: {requestedModule}. Valid names: {string.Join(", ", ModuleNames)}");
            }
        }