Initialize() public method

public Initialize ( ) : void
return void
Ejemplo n.º 1
0
        private static int Main(string[] args)
        {
            var commandArgs = ParseArguments(args) ?? new ScriptCsArgs { Repl = true };

            var compositionRoot = new CompositionRoot(commandArgs);
            compositionRoot.Initialize();

            var logger = compositionRoot.GetLogger();
            logger.Debug("Creating ScriptServiceRoot");

            var scriptServiceRoot = compositionRoot.GetServiceRoot();

            var commandFactory = new CommandFactory(scriptServiceRoot);
            var command = commandFactory.CreateCommand(commandArgs);
            var result = command.Execute();

            return result == CommandResult.Success ? 0 : -1;
        }
Ejemplo n.º 2
0
        private static int Main(string[] args)
        {
            ScriptCsArgs commandArgs;

            const string unexpectedArgumentMessage = "Unexpected Argument: ";
            try
            {
                commandArgs = Args.Parse<ScriptCsArgs>(args);
            }
            catch (ArgException ex)
            {
                commandArgs = new ScriptCsArgs();

                if (ex.Message.StartsWith(unexpectedArgumentMessage))
                {
                    var token = ex.Message.Substring(unexpectedArgumentMessage.Length);
                    Console.WriteLine("Parameter \"{0}\" is not supported!", token);
                }
                else
                {
                    Console.WriteLine(ex.Message);
                }
            }

            var debug = commandArgs.DebugFlag;
            var compositionRoot = new CompositionRoot(debug);
            compositionRoot.Initialize();
            var scriptServiceRoot = compositionRoot.GetServiceRoot();

            var commandFactory = new CommandFactory(scriptServiceRoot);
            var command = commandFactory.CreateCommand(commandArgs);

            var result = command.Execute();

            switch (result)
            {
                case CommandResult.Success:
                    return 0;
                default:
                    return -1;
            }
        }
Ejemplo n.º 3
0
        private static int Main(string[] args)
        {
            var commandArgs = ParseArguments(args) ?? new ScriptCsArgs {
                Repl = true
            };

            var compositionRoot = new CompositionRoot(commandArgs);

            compositionRoot.Initialize();

            var logger = compositionRoot.GetLogger();

            logger.Debug("Creating ScriptServiceRoot");

            var scriptServiceRoot = compositionRoot.GetServiceRoot();

            var commandFactory = new CommandFactory(scriptServiceRoot);
            var command        = commandFactory.CreateCommand(commandArgs);
            var result         = command.Execute();

            return(result == CommandResult.Success ? 0 : -1);
        }