Ejemplo 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);
        }
Ejemplo n.º 2
0
        public BaseTest()
        {
            FactoryBusinessOperation.ClearRegisteredItems();
            FactoryBusinessOperation.RegisterBusinessOperations(BusinessErpOperations.GetInstance().ExportedServicesList());

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