From d05410a938593a9a9c804ff83c228d2d57c75808 Mon Sep 17 00:00:00 2001 From: Dmitry Afanasyev Date: Wed, 1 Jun 2016 10:32:58 +0300 Subject: [PATCH] Add support to specify collection and collectionImplementationType in console app --- XmlSchemaClassGenerator.Console/Program.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/XmlSchemaClassGenerator.Console/Program.cs b/XmlSchemaClassGenerator.Console/Program.cs index 6a35afd4..e813bac2 100644 --- a/XmlSchemaClassGenerator.Console/Program.cs +++ b/XmlSchemaClassGenerator.Console/Program.cs @@ -1,6 +1,7 @@ using XmlSchemaClassGenerator; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Text; @@ -27,6 +28,8 @@ static void Main(string[] args) var entityFramework = false; var interfaces = true; var pascal = true; + var collectionType = typeof(Collection<>); + Type collectionImplementationType = null; var options = new OptionSet { { "h|help", "show this message and exit", v => showHelp = v != null }, @@ -63,6 +66,8 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l { "f|ef", "generate Entity Framework Code First compatible classes", v => entityFramework = v != null }, { "t|interface", "generate interfaces for groups and attribute groups (default is enabled)", v => interfaces = v != null }, { "a|pascal", "use Pascal case for class and property names (default is enabled)", v => pascal = v != null }, + { "ct|collectionType=", "collection type to use (default is " + typeof(Collection<>).FullName + ")", v => collectionType = v == null ? typeof(Collection<>) : Type.GetType(v, true) }, + { "cit|collectionImplementationType=", "the default collection type implementation to use (default is null)", v => collectionImplementationType = v == null ? null : Type.GetType(v, true) }, }; var files = options.Parse(args); @@ -97,7 +102,9 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l IntegerDataType = integerType, EntityFramework = entityFramework, GenerateInterfaces = interfaces, - NamingScheme = pascal ? NamingScheme.PascalCase : NamingScheme.Direct + NamingScheme = pascal ? NamingScheme.PascalCase : NamingScheme.Direct, + CollectionType = collectionType, + CollectionImplementationType = collectionImplementationType }; if (pclCompatible)