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); }
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()))); }
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()))); }
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)); }
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)); }
public EnhancedServiceBuilder AddCaching(CachingParams cachingParams = null) { ValidateInitialised(); ValidateFinalised(false); parameters.IsCachingEnabled = true; parameters.CachingParams = cachingParams ?? new CachingParams(); return(this); }