Esempio n. 1
0
        private static void SetupFactory(ILoggerFactory logFactory)
        {
            string host     = Environment.GetEnvironmentVariable("MAGNUM_FIREBASE_URL");
            string key      = Environment.GetEnvironmentVariable("MAGNUM_FIREBASE_KEY");
            string user     = Environment.GetEnvironmentVariable("MAGNUM_DB_USERNAME");
            string password = Environment.GetEnvironmentVariable("MAGNUM_DB_PASSWORD");
            string bucket   = Environment.GetEnvironmentVariable("MAGNUM_FIREBASE_BUCKET");

            Microsoft.Extensions.Logging.ILogger logger = logFactory.CreateLogger <FirebaseNoSqlContext>();

            FirebaseNoSqlContext ctx = new FirebaseNoSqlContext();

            ctx.SetLogger(logger);
            ctx.Authenticate(host, key, user, password);

            var storageCtx = new FirebaseStorageContext();

            storageCtx.Authenticate(bucket, key, user, password);

            FactoryBusinessOperation.SetStorageContext(storageCtx);
            FactoryBusinessOperation.SetNoSqlContext(ctx);
            FactoryBusinessOperation.SetLoggerFactory(logFactory);
            FactoryBusinessOperation.RegisterBusinessOperations(BusinessErpOperations.GetInstance().ExportedServicesList());

            FactoryCacheContext.RegisterCaches(BusinessErpCaches.GetInstance().ExportedServicesList());
            FactoryCacheContext.SetLoggerFactory(logFactory);
        }
Esempio n. 2
0
        public BaseTest()
        {
            FactoryBusinessOperation.ClearRegisteredItems();
            FactoryBusinessOperation.RegisterBusinessOperations(BusinessErpOperations.GetInstance().ExportedServicesList());

            FactoryCacheContext.ClearRegisteredItems();
            FactoryCacheContext.RegisterCaches(BusinessErpCaches.GetInstance().ExportedServicesList());
        }
Esempio n. 3
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();
        }
Esempio n. 4
0
 public virtual ICacheContext GetContentCache()
 {
     return(FactoryCacheContext.GetCacheObject("CachePageContents"));
 }
Esempio n. 5
0
 public virtual ICacheContext GetProductTypeCache()
 {
     return(FactoryCacheContext.GetCacheObject("CacheProductTypeList"));
 }
Esempio n. 6
0
 public virtual ICacheContext GetMetricsCache()
 {
     return(FactoryCacheContext.GetCacheObject("CacheMetrics"));
 }