/// <inheritdoc />
        protected override void WriteMetadata(System.IO.TextWriter writer, Metadata.Edmx edmx)
        {
            var requestedModule = HttpContext.Current.Request["module"]?.ToLowerInvariant();

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

            var schema0 = new ContentRepository.Schema.Metadata.Schema(new[] { "Application", "ApplicationCacheFile", "FieldSettingContent", "JournalNode" });
            var context = new TypescriptGenerationContext();
            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: enums, complextypes, contenttypes, resources, schemas, fieldsettings.");
            }
        }
Example #2
0
 public TypescriptEnumsVisitor(TypescriptGenerationContext context, TextWriter writer) : base(context, writer)
 {
 }
Example #3
0
 protected TypescriptModuleWriter(TypescriptGenerationContext context, TextWriter writer) : base(context)
 {
     _writer = writer;
 }
 protected TypescriptSchemaVisitor(TypescriptGenerationContext context)
 {
     this.Context = context;
 }
Example #5
0
 public TypescriptFieldSettingsVisitor(TypescriptGenerationContext context, TextWriter writer) : base(context, writer)
 {
 }
Example #6
0
 public TypescriptTypeCollectorVisitor(TypescriptGenerationContext context) : base(context)
 {
 }