Example #1
0
        public void Setup()
        {
            FactoryConsoleApplication.SetLoggerFactory(new Mock <ILoggerFactory>().Object);
            h = new Hashtable()
            {
                { "host", "xxxx.firebase.com" },
                { "key", "firebase_key" },
                { "infile", fileName },
                { "basedir", tempPath },
                { "user", "pjame" },
                { "password", "faked_password" },
            };

            args = new string[]
            {
                string.Format("--h={0}", h["host"]),
                string.Format("--k={0}", h["key"]),
                string.Format("--infile={0}", h["infile"]),
                string.Format("--basedir={0}", h["basedir"]),
                string.Format("--user={0}", h["user"]),
                string.Format("--password={0}", h["password"]),
            };
        }
Example #2
0
        public static void Main(string[] args)
        {
            if (args.Length <= 0)
            {
                Console.WriteLine("Missing application name!!!");
                return;
            }

            FactoryBusinessOperation.ClearRegisteredItems();
            FactoryBusinessOperation.RegisterBusinessOperations(BusinessErpOperations.GetInstance().ExportedServicesList());

            FactoryCacheContext.ClearRegisteredItems();
            FactoryCacheContext.RegisterCaches(BusinessErpCaches.GetInstance().ExportedServicesList());

            string appName = args[0];

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddLogging(builder => builder.AddSerilog());

            var serviceProvider = serviceCollection.BuildServiceProvider();
            var loggerFactory   = serviceProvider.GetService <ILoggerFactory>();

            Log.Logger = new LoggerConfiguration()
                         .Enrich.FromLogContext()
                         .WriteTo.Console()
                         .CreateLogger();

            FactoryConsoleApplication.SetLoggerFactory(loggerFactory);
            IApplication app = FactoryConsoleApplication.CreateConsoleApplicationObject(appName);

            OptionSet opt = app.CreateOptionSet();

            opt.Parse(args);

            app.Run();
        }