Esempio n. 1
0
        private static EnhancedServiceParams BuildBaseParams(string connectionString, int poolSize,
                                                             PoolParams poolParams       = null, ConnectionParams connectionParams = null,
                                                             CachingParams cachingParams = null)
        {
            var parameters =
                new EnhancedServiceParams
            {
                ConnectionParams = connectionParams ?? new ConnectionParams {
                    ConnectionString = connectionString
                },
                PoolParams = poolParams ?? new PoolParams {
                    PoolSize = poolSize
                }
            };

            if (cachingParams != null)
            {
                parameters.IsCachingEnabled = true;
                parameters.CachingParams    = cachingParams;
            }

            if (AutoSetMaxPerformanceParams)
            {
                parameters.AutoSetMaxPerformanceParams();
            }

            return(parameters);
        }
Esempio n. 2
0
 public static IEnhancedServicePool <ICachingOrgService> GetCachingPool(string connectionString, int poolSize = 2,
                                                                        CachingParams cachingParams           = null)
 {
     connectionString.RequireFilled(nameof(connectionString));
     return(GetCachingPool(BuildBaseParams(connectionString, poolSize, null,
                                           cachingParams: cachingParams ?? new CachingParams())));
 }
Esempio n. 3
0
 public static IEnhancedServicePool <ICachingOrgService> GetCachingPool(ConnectionParams connectionParams, PoolParams poolParams,
                                                                        CachingParams cachingParams = null)
 {
     connectionParams.Require(nameof(connectionParams));
     poolParams.Require(nameof(poolParams));
     return(GetCachingPool(BuildBaseParams(null, null, poolParams, connectionParams,
                                           cachingParams ?? new CachingParams())));
 }
Esempio n. 4
0
        public static IEnhancedServicePool <ICachingOrgService> GetPoolCaching(ConnectionParams connectionParams, PoolParams poolParams,
                                                                               CachingParams cachingParams = null)
        {
            var parameters = BuildBaseParams(string.Empty, 2, null, connectionParams,
                                             cachingParams ?? new CachingParams());
            var factory = new EnhancedServiceFactory <ICachingOrgService, CachingOrgService>(parameters);

            return(new EnhancedServicePool <ICachingOrgService, CachingOrgService>(factory, poolParams));
        }
Esempio n. 5
0
        public static IEnhancedServicePool <ICachingOrgService> GetPoolCaching(string connectionString, int poolSize = 2,
                                                                               CachingParams cachingParams           = null)
        {
            var parameters = BuildBaseParams(connectionString, poolSize, null,
                                             cachingParams: cachingParams ?? new CachingParams());
            var factory = new EnhancedServiceFactory <ICachingOrgService, CachingOrgService>(parameters);

            return(new EnhancedServicePool <ICachingOrgService, CachingOrgService>(factory, poolSize));
        }
Esempio n. 6
0
        public EnhancedServiceBuilder AddCaching(CachingParams cachingParams = null)
        {
            ValidateInitialised();
            ValidateFinalised(false);

            parameters.IsCachingEnabled = true;
            parameters.CachingParams    = cachingParams ?? new CachingParams();

            return(this);
        }