//private Dictionary<string, IShardSetConnectionDriver> _cachedDrivers = new Dictionary<string, IShardSetConnectionDriver>();

        public Shardlet GetShardlet(string shardSetName, string shardingKey, short?spid = null)
        {
            var shardletConnectionDriver = GetShardletConnectionDriver(shardSetName);
            var settings = ScaleOutSettingsManager.GetManager().GetSettings();

            var shardSetDriver  = _container.Resolve <IShardSetDriver>(shardSetName);
            var distributionKey = shardSetDriver.GetDistributionKeyForShardingKey(shardingKey);

            var shardlet = shardletConnectionDriver.GetShardletByShardingKey(shardSetName, shardingKey, distributionKey);

            if (shardlet == null)
            {
                // would only arrive here if the shardmap is not yet
                // published and the shardlet is not pinned somewhere
                return(null);
            }

            shardlet.UserName = settings.ShardUser;
            shardlet.Password = settings.ShardPassword;

            if (spid.HasValue)
            {
                shardletConnectionDriver.PublishShardletConnection(shardlet, spid.Value);
            }

            return(shardlet);
        }
        public Shardlet GetShardlet(string shardSetName, string dataSetName, string uniqueValue)
        {
            var driver             = GetShardletConnectionDriver(shardSetName);
            var settings           = ScaleOutSettingsManager.GetManager().GetSettings();
            var shardletConnection = driver.GetShardlet(shardSetName, dataSetName, uniqueValue);

            shardletConnection.UserName = settings.ShardUser;
            shardletConnection.Password = settings.ShardPassword;
            return(shardletConnection);
        }
        public Shardlet GetShardlet(string shardSetName, long distributionKey, bool isNew = false)
        {
            var driver   = GetShardletConnectionDriver(shardSetName);
            var settings = ScaleOutSettingsManager.GetManager().GetSettings();

            var shardletConnection = driver.GetShardletByDistributionKey(shardSetName, distributionKey, isNew);

            shardletConnection.UserName = settings.ShardUser;
            shardletConnection.Password = settings.ShardPassword;

            return(shardletConnection);
        }