public static CommonConfigurator UseStydMySql(this CommonConfigurator configurator, Action <DBOptions> configOptions = null, DBOptions options = null)
        {
            Engine.PreventDuplicateRegistration(nameof(UseStydMySql));

            options = options ?? new DBOptions();
            configOptions?.Invoke(options);

            if (!Engine.IsStarted)
            {
                configurator.Engine.Starting += (o, e) =>
                {
                    ObjectContainer.Register <IMasterDB>(() => new MasterDB(options.DBConnStrName), LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IProductDAL, ProductDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IProductItemDAL, ProductItemDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IUserDAL, UserDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IShoppingCartDAL, ShoppingCartDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <ICommonDAL, CommonDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IOrderDAL, OrderDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IOrderItemDAL, OrderItemDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IReviewDAL, ReviewDAL>(LifeCycleEnum.Singleton);
                };
            }

            return(configurator);
        }
        public static CommonConfigurator UseStydRedis(this CommonConfigurator configurator, Action <DBOptions> configOptions = null, DBOptions options = null)
        {
            Engine.PreventDuplicateRegistration(nameof(UseStydRedis));

            options = options ?? new DBOptions();
            configOptions?.Invoke(options);

            //if (!Engine.IsStarted)
            //{
            //    configurator.Engine.Starting += (o, e) =>
            //    {
            //        ObjectContainer.Register<IInventoryDB>(() => new InventoryDB(options.DBConnStrName), LifeCycleEnum.Singleton);
            //        ObjectContainer.Register<IInventoryDAL, InventoryQueryDAL>(LifeCycleEnum.Singleton);
            //    };
            //}

            return(configurator);
        }
Exemple #3
0
        public static CommonConfigurator UseStylesDeliveredMongoDB(this CommonConfigurator configurator, Action <DBOptions> configOptions = null, DBOptions options = null)
        {
            Engine.PreventDuplicateRegistration(nameof(UseStylesDeliveredMongoDB));

            options = options ?? new DBOptions();
            configOptions?.Invoke(options);

            if (!Engine.IsStarted)
            {
                configurator.Engine.Starting += (o, e) =>
                {
                    ObjectContainer.Register <IStylesDeliveredDB>(() => new StylesDeliveredDB(options.ConnStrName), LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IProductDAL, ProductDAL>(LifeCycleEnum.Singleton);
                    ObjectContainer.Register <IUserDAL, UserDAL>(LifeCycleEnum.Singleton);
                };
            }

            return(configurator);
        }