Beispiel #1
0
        public ShardedCriteriaImpl(ShardedCriteriaImpl other)
        {
            Preconditions.CheckNotNull(other);

            this.session              = other.session;
            this.criteriaFactory      = other.criteriaFactory;
            this.exitOperationBuilder = new ExitOperationBuilder(other.exitOperationBuilder);
            this.establishActions     = other.establishActions;
            this.subcriteriaByAlias   = new Dictionary <string, ICriteria>(other.subcriteriaByAlias);
            this.subcriteriaByPath    = new Dictionary <string, Subcriteria>(other.subcriteriaByPath);
        }
Beispiel #2
0
 public Subcriteria(ShardedCriteriaImpl root, string alias, Func <ICriteria, ICriteria> subcriteriaFactory)
 {
     this.root               = root;
     this.subcriteriaAlias   = alias;
     this.subcriteriaFactory = subcriteriaFactory;
 }
Beispiel #3
0
 public FutureValueShardOperation(ShardedCriteriaImpl shardedCriteria)
 {
     this.session        = shardedCriteria.session;
     this.futuresByShard = shardedCriteria.session.Shards
                           .ToDictionary(s => s, s => shardedCriteria.EstablishFor(s).FutureValue <T>());
 }
 protected internal ShardedQueryOver(ShardedCriteriaImpl shardedCriteria)
     : base((CriteriaImpl)shardedCriteria.SomeCriteria, shardedCriteria)
 {
 }
Beispiel #5
0
        private static ICriteria ToShardedCriteria(CriteriaImpl other, IShardedSessionImplementor shardedSession)
        {
            Preconditions.CheckNotNull(other);
            Preconditions.CheckNotNull(shardedSession);

            var entityName = other.EntityOrClassName;
            var alias      = other.Alias;

            ICriteria CriteriaFactory(ISession s) =>
            alias != null
                                        ? s.CreateCriteria(entityName, alias)
                                        : s.CreateCriteria(entityName);

            var result = new ShardedCriteriaImpl(shardedSession, other.EntityOrClassName, CriteriaFactory);

            foreach (var entry in other.IterateSubcriteria())
            {
                result.CreateCriteria(entry.Path, entry.Alias, entry.JoinType, entry.WithClause);
            }
            foreach (var entry in other.IterateExpressionEntries())
            {
                result.Add(entry.Criterion);
            }
            foreach (var entry in other.LockModes)
            {
                result.SetLockMode(entry.Key, entry.Value);
            }
            foreach (var entry in other.IterateOrderings())
            {
                result.AddOrder(entry.Order);
            }

            if (other.Cacheable)
            {
                result.SetCacheable(true);
                if (other.CacheMode != null)
                {
                    result.SetCacheMode(other.CacheMode.Value);
                }
                if (other.CacheRegion != null)
                {
                    result.SetCacheRegion(other.CacheRegion);
                }
            }

            if (other.Comment != null)
            {
                result.SetComment(other.Comment);
            }
            if (other.FetchSize > 0)
            {
                result.SetFetchSize(other.FetchSize);
            }
            if (other.FirstResult > 0)
            {
                result.SetFirstResult(other.FirstResult);
            }
            if (other.MaxResults > 0)
            {
                result.SetMaxResults(other.MaxResults);
            }
            if (other.Projection != null)
            {
                result.SetProjection(other.Projection);
            }
            if (other.ResultTransformer != null)
            {
                result.SetResultTransformer(other.ResultTransformer);
            }
            if (other.Timeout > 0)
            {
                result.SetTimeout(other.Timeout);
            }
            if (other.IsReadOnlyInitialized)
            {
                result.SetReadOnly(other.IsReadOnly);
            }

            return(result);
        }