public Subset(
     ShardedSessionFactoryImpl parent,
     IEnumerable <ShardId> shardIds,
     IShardStrategyFactory shardStrategyFactory)
     : base(parent, shardIds, shardStrategyFactory)
 {
 }
        protected ShardedSessionFactoryImpl(
            ShardedSessionFactoryImpl parent,
            IEnumerable <ShardId> shardIds,
            IShardStrategyFactory shardStrategyFactory)
        {
            this.shardIdsBySessionFactory                    = new Dictionary <ISessionFactoryImplementor, ICollection <ShardId> >();
            this.classesWithoutTopLevelSaveSupport           = parent.classesWithoutTopLevelSaveSupport;
            this.checkAllAssociatedObjectsForDifferentShards = parent.checkAllAssociatedObjectsForDifferentShards;
            this.controlSessionFactory = parent.controlSessionFactory;

            var uniqueShardIds = new HashSet <ShardId>(shardIds);

            foreach (var pair in parent.shardIdsBySessionFactory)
            {
                var shardIdsSubset = new HashSet <ShardId>(pair.Value);
                shardIdsSubset.IntersectWith(uniqueShardIds);
                if (shardIdsSubset.Count > 0)
                {
                    this.shardIdsBySessionFactory.Add(pair.Key, shardIdsSubset);
                }
            }

            shardStrategy = shardStrategyFactory.NewShardStrategy(
                shardIdsBySessionFactory.SelectMany(c => c.Value));
        }
        protected ShardedSessionFactoryImpl(
            ShardedSessionFactoryImpl parent,
            IEnumerable<ShardId> shardIds,
            IShardStrategyFactory shardStrategyFactory)
        {
            this.shardIdsBySessionFactory = new Dictionary<ISessionFactoryImplementor, ICollection<ShardId>>();
            this.classesWithoutTopLevelSaveSupport = parent.classesWithoutTopLevelSaveSupport;
            this.checkAllAssociatedObjectsForDifferentShards = parent.checkAllAssociatedObjectsForDifferentShards;
            this.controlSessionFactory = parent.controlSessionFactory;

            var uniqueShardIds = new HashSet<ShardId>(shardIds);
            foreach (var pair in parent.shardIdsBySessionFactory)
            {
                var shardIdsSubset = new HashSet<ShardId>(pair.Value);
                shardIdsSubset.IntersectWith(uniqueShardIds);
                if (shardIdsSubset.Count > 0)
                {
                    this.shardIdsBySessionFactory.Add(pair.Key, shardIdsSubset);
                }
            }

            shardStrategy = shardStrategyFactory.NewShardStrategy(
                shardIdsBySessionFactory.SelectMany(c => c.Value));
        }
 public Subset(
     ShardedSessionFactoryImpl parent,
     IEnumerable<ShardId> shardIds,
     IShardStrategyFactory shardStrategyFactory)
     : base(parent, shardIds, shardStrategyFactory)
 {
 }
Пример #5
0
 internal ShardedSessionBuilder(ShardedSessionFactoryImpl shardedSessionFactory)
 {
     Preconditions.CheckNotNull(shardedSessionFactory);
     this.shardedSessionFactory = shardedSessionFactory;
 }