Skip to content

Commit

Permalink
Merge pull request #14 from dafanasiev/master
Browse files Browse the repository at this point in the history
Add support to specify collection and collectionImplementationType in console app
  • Loading branch information
mganss committed Jun 1, 2016
2 parents 8996b59 + d05410a commit d056787
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion XmlSchemaClassGenerator.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 },
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d056787

Please sign in to comment.