Exemplo n.º 1
0
        /// <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.");
            }
        }
Exemplo n.º 2
0
 public TypescriptEnumsVisitor(TypescriptGenerationContext context, TextWriter writer) : base(context, writer)
 {
 }
Exemplo n.º 3
0
 protected TypescriptModuleWriter(TypescriptGenerationContext context, TextWriter writer) : base(context)
 {
     _writer = writer;
 }
Exemplo n.º 4
0
 protected TypescriptSchemaVisitor(TypescriptGenerationContext context)
 {
     this.Context = context;
 }
Exemplo n.º 5
0
 public TypescriptFieldSettingsVisitor(TypescriptGenerationContext context, TextWriter writer) : base(context, writer)
 {
 }
Exemplo n.º 6
0
 public TypescriptTypeCollectorVisitor(TypescriptGenerationContext context) : base(context)
 {
 }