Breeze.PocoMetadata.Program.Main C# (CSharp) Method

Main() static private method

static private Main ( string args ) : void
args string
return void
        static void Main(string[] args)
        {
            var procname = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
            Console.WriteLine(procname + ' ' + string.Join(" ", args));
            var parser = new CommandLine.Parser(ps => { ps.MutuallyExclusive = true; ps.HelpWriter = Console.Out; });

            if (!parser.ParseArguments(args, Options))
            {
                return;
            }
            var assemblyName = GetAssemblyName(Options.InputFile);

            if (!File.Exists(assemblyName))
            {
                Console.WriteLine("The specified file {0} cannot be found", assemblyName);
                return;
            }
            string outfile = GetFilePath();

            // TODO: how to get this from the command line?
            EntityDescriptor descriptor;
            if (assemblyName.Contains("Northwind"))
                descriptor = new NorthwindEntityDescriptor();
            else
                descriptor = new EntityDescriptor();

            var metadata = Generator.Generate(assemblyName, descriptor);
            var json = ToJson(metadata);

            if (outfile != null)
            {
                Console.WriteLine("Writing to " + outfile);
                File.WriteAllText(outfile, json);
            }
            else
            {
                Console.WriteLine(json);
            }
            Console.WriteLine("Done");
        }