protected override ClassTemplate WriteClass(IModelConfiguration configuration, ModelTransferObject model, string nameSpace, List <FileTemplate> files) { ClassTemplate classTemplate = base.WriteClass(configuration, model, nameSpace, files); if (!model.IsAbstract && !model.IsInterface && configuration.Language.IsTypeScript()) { ConstructorTemplate constructor = classTemplate.AddConstructor(); constructor.WithParameter(Code.Generic("Partial", classTemplate.ToType()), "init", Code.Null()) .WithCode(Code.Static(Code.Type("Object")).Method("assign", Code.This(), Code.Local("init")).Close()); if (classTemplate.BasedOn.Any(x => !x.ToType().IsInterface)) { // TODO: Add super parameters constructor.WithSuper(); } } return(classTemplate); }
protected override ClassTemplate WriteClass(ModelTransferObject model, string relativePath) { IOptions modelOptions = this.Options.Get(model); ClassTemplate classTemplate = base.WriteClass(model, relativePath); if (!model.IsAbstract && !classTemplate.IsInterface && modelOptions.Language.IsTypeScript()) { ConstructorTemplate constructor = classTemplate.AddConstructor(); constructor.AddParameter(Code.Generic("Partial", classTemplate.ToType()), "init").Optional(); constructor.WithCode(Code.Static(Code.Type("Object")).Method("assign", Code.This(), Code.Local("init")).Close()); if (classTemplate.BasedOn.Any(x => !x.ToType().IsInterface)) { // TODO: Add super parameters constructor.WithSuper(); } } return(classTemplate); }