Esempio n. 1
0
        public ShardStrategy(IDictionary<string, IAsyncFilesCommands> shards)
		{
			if (shards == null) throw new ArgumentNullException("shards");
			if (shards.Count == 0)
				throw new ArgumentException("Shards collection must have at least one item", "shards");

            this.shards = new Dictionary<string, IAsyncFilesCommands>(shards, StringComparer.OrdinalIgnoreCase);


			Conventions = shards.First().Value.Conventions.Clone();

			ShardAccessStrategy = new SequentialShardAccessStrategy();
			ShardResolutionStrategy = new DefaultShardResolutionStrategy(shards.Keys, this);
			ModifyFileName = (convention, shardId, documentId) => convention.IdentityPartsSeparator + shardId + convention.IdentityPartsSeparator + documentId;
		}
Esempio n. 2
0
        public ShardStrategy(IDictionary <string, IAsyncFilesCommands> shards)
        {
            if (shards == null)
            {
                throw new ArgumentNullException("shards");
            }
            if (shards.Count == 0)
            {
                throw new ArgumentException("Shards collection must have at least one item", "shards");
            }

            this.shards = new Dictionary <string, IAsyncFilesCommands>(shards, StringComparer.OrdinalIgnoreCase);


            Conventions = shards.First().Value.Conventions.Clone();

            ShardAccessStrategy     = new SequentialShardAccessStrategy();
            ShardResolutionStrategy = new DefaultShardResolutionStrategy(shards.Keys, this);
            ModifyFileName          = (convention, shardId, documentId) => convention.IdentityPartsSeparator + shardId + convention.IdentityPartsSeparator + documentId;
        }