/// <summary> /// Generates a string containing js definitions of the provided types and all implied descendant types. /// </summary> /// <param name="typesToGenerate">The types to generate.</param> /// <param name="generatorOptions">The generator options. Uses global settings if not provided.</param> /// <returns></returns> public static string Generate(IEnumerable <Type> typesToGenerate, JsGeneratorOptions generatorOptions = null) { var passedOptions = generatorOptions ?? Options; if (passedOptions == null) { throw new ArgumentNullException(nameof(passedOptions), "Options cannot be null."); } var propertyClassCollection = TypePropertyDictionaryGenerator.GetPropertyDictionaryForTypeGeneration(typesToGenerate, passedOptions); var js = GenerateJs(propertyClassCollection, passedOptions); return(js); }
public static string GenerateJsModelFromTypeWithDescendants(Type modelType, bool camelCasePropertyNames, string outputNamespace) { var propertyDictionary = TypePropertyDictionaryGenerator.GetPropertyDictionaryForTypeGeneration(new[] { modelType }, Options); return(GenerateJs(propertyDictionary, new JsGeneratorOptions() { CamelCase = camelCasePropertyNames, ClassNameConstantsToRemove = new List <string>() { "Dto" }, OutputNamespace = outputNamespace, IncludeMergeFunction = true })); }