public ShardedFilterImpl(IShardedSessionImplementor shardedSession, string name) { Preconditions.CheckNotNull(shardedSession); Preconditions.CheckNotNull(name); this.shardedSession = shardedSession; this.filterName = name; }
/// <summary> /// Creates new <see cref="ShardedQueryImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> /// <param name="queryFactory">Factory method for creation of shard-local <see cref="IQuery"/> instances.</param> protected ShardedQueryImpl(IShardedSessionImplementor session, Func <ISession, IQuery> queryFactory) { Preconditions.CheckNotNull(session); Preconditions.CheckNotNull(queryFactory); this.session = session; this.queryFactory = queryFactory; }
public ShardImpl(IShardedSessionImplementor shardedSession, IShardMetadata shardMetadata) : base(shardMetadata.ShardIds) { // make a copy to be safe this.shardedSession = shardedSession; this.sessionFactory = shardMetadata.SessionFactory; }
/// <summary> /// Creates new <see cref="ShardedQueryImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> /// <param name="unshardedQueryExpressionPlan">A shard-local <see cref="IQueryExpressionPlan"/> that represents /// a parsed HQL string or the HQL equivalent of a Linq expression.</param> public ShardedQueryImpl(IShardedSessionImplementor session, IQueryExpressionPlan unshardedQueryExpressionPlan) { Preconditions.CheckNotNull(session); Preconditions.CheckNotNull(unshardedQueryExpressionPlan); this.session = session; this.unshardedQueryExpressionPlan = unshardedQueryExpressionPlan; this.queryFactory = s => ApplyLimits(s.GetSessionImplementation().CreateQuery(this.QueryExpression)); }
public ShardImpl(IShardedSessionImplementor shardedSession, IShardMetadata shardMetadata) : base(shardMetadata.ShardIds) { Preconditions.CheckNotNull(shardedSession); Preconditions.CheckNotNull(shardMetadata); this.shardedSession = shardedSession; this.sessionFactory = shardMetadata.SessionFactory; }
public ShardedCriteriaImpl(IShardedSessionImplementor session, Func <ISession, ICriteria> criteriaFactory) { Preconditions.CheckNotNull(session); Preconditions.CheckNotNull(criteriaFactory); this.session = session; this.criteriaFactory = criteriaFactory; this.subcriteriaByAlias[CriteriaSpecification.RootAlias] = this; }
/// <summary> /// Creates new <see cref="ShardedQueryImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> /// <param name="hql">An HQL query string.</param> public static ShardedQueryImpl CreateQuery(IShardedSessionImplementor session, string hql) { var anySessionImplementor = (AbstractSessionImpl)session.AnyShard.EstablishSession(); var unshardedQueryExpression = new StringQueryExpression(hql); var unshardedQueryPlan = anySessionImplementor.Factory.QueryPlanCache.GetHQLQueryPlan( unshardedQueryExpression, false, anySessionImplementor.EnabledFilters); return(new ShardedQueryImpl(session, unshardedQueryPlan)); }
public static ShardedQueryImpl GetNamedQuery(IShardedSessionImplementor session, string queryName) { var anySession = session.AnyShard.EstablishSession(); var query = anySession.GetNamedQuery(queryName); return(query is ISQLQuery ? new ShardedQueryImpl(session, s => s.GetNamedQuery(queryName)) : CreateQuery(session, query.QueryString)); }
private void AfterTransactionCompletion(bool?success) { if (this.shardedSession != null) { shardedSession.AfterTransactionCompletion(this, success); this.shardedSession = null; } begun = false; NotifyLocalSynchsAfterTransactionCompletion(success); }
private Task AfterTransactionCompletionAsync(bool?success, CancellationToken cancellationToken) { if (this.shardedSession != null) { shardedSession.AfterTransactionCompletion(this, success); this.shardedSession = null; } begun = false; return(NotifyLocalSynchsAfterTransactionCompletionAsync(success, cancellationToken)); }
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); }
public ShardedCriteriaImpl(IShardedSessionImplementor session, Func <ISession, ICriteria> criteriaFactory) { Preconditions.CheckNotNull(session); Preconditions.CheckNotNull(criteriaFactory); this.session = session; this.criteriaFactory = criteriaFactory; this.listExitOperationBuilder = new ListExitOperationBuilder(); this.establishActions = new List <Action <ICriteria> >(); this.subcriteriaByAlias = new Dictionary <string, ICriteria> { { CriteriaSpecification.RootAlias, this } }; this.subcriteriaByPath = new Dictionary <string, Subcriteria>(); }
public ShardedCriteriaImpl(IShardedSessionImplementor session, string entityName, Func <ISession, ICriteria> criteriaFactory) { Preconditions.CheckNotNull(session); Preconditions.CheckNotNull(entityName); Preconditions.CheckNotNull(criteriaFactory); this.session = session; this.entityName = entityName; this.criteriaFactory = criteriaFactory; this.exitOperationBuilder = new ExitOperationBuilder(); this.subcriteriaByAlias = new Dictionary <string, ICriteria> { { CriteriaSpecification.RootAlias, this } }; this.subcriteriaByPath = new Dictionary <string, Subcriteria>(); }
public void Dispose() { if (!disposed) { disposed = true; DisposeShardTransactions(); transactions = null; // Assume transaction rollback if (this.IsActive) { shardedSession.AfterTransactionCompletion(this, false); } shardedSession = null; } }
public ShardedSessionStatistics(IShardedSessionImplementor session) { sessionStats = new HashedSet <ISessionStatistics>(); foreach (IShard shard in session.Shards) { if (shard.Session != null) { sessionStats.Add(shard.Session.Statistics); } else { IOpenSessionEvent ose = new StatOpenSessionEvent(sessionStats); shard.AddOpenSessionEvent(ose); } } }
public ShardedTransactionImpl(IShardedSessionImplementor ssi) { IOpenSessionEvent osEvent = new SetupTransactionOpenSessionEvent(this); transactions = new SynchronizedCollection<ITransaction>(); foreach (IShard shard in ssi.Shards) { if (shard.Session != null) { transactions.Add(shard.Session.Transaction); } else { shard.AddOpenSessionEvent(osEvent); } } }
public ShardedSessionStatistics(IShardedSessionImplementor session) { sessionStats = new HashedSet<ISessionStatistics>(); foreach(IShard shard in session.Shards) { if(shard.Session != null) { sessionStats.Add(shard.Session.Statistics); } else { IOpenSessionEvent ose = new StatOpenSessionEvent(sessionStats); shard.AddOpenSessionEvent(ose); } } }
public ShardedTransactionImpl(IShardedSessionImplementor ssi) { IOpenSessionEvent osEvent = new SetupTransactionOpenSessionEvent(this); transactions = new SynchronizedCollection <ITransaction>(); foreach (IShard shard in ssi.Shards) { if (shard.Session != null) { transactions.Add(shard.Session.Transaction); } else { shard.AddOpenSessionEvent(osEvent); } } }
public FutureValueShardOperation(ShardedCriteriaImpl shardedCriteria) { this.session = shardedCriteria.session; this.futuresByShard = shardedCriteria.session.Shards .ToDictionary(s => s, s => shardedCriteria.EstablishFor(s).FutureValue <T>()); }
public ShardedTransactionImpl(IShardedSessionImplementor ssi, IsolationLevel isoLevel) : this(ssi) { this.isoLevel = isoLevel; }
public ShardedSQLQueryImpl(IShardedSessionImplementor session, string queryString) : base(session, s => s.CreateSQLQuery(queryString)) {}
/// <summary> /// Creates new <see cref="ShardedQueryImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> /// <param name="hql">An HQL query string.</param> public static ShardedQueryImpl CreateQuery(IShardedSessionImplementor session, string hql) { return(new ShardedQueryImpl(session, s => s.CreateQuery(hql))); }
public static ShardedQueryImpl GetNamedQuery(IShardedSessionImplementor session, string queryName) { return(new ShardedQueryImpl(session, s => s.GetNamedQuery(queryName))); }
public ShardedTransactionImpl(IShardedSessionImplementor shardedSession) : this(shardedSession, IsolationLevel.Unspecified) { }
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); }
public ShardedSQLQueryImpl(IShardedSessionImplementor session, string queryString) : base(session, s => s.CreateSQLQuery(queryString)) { }
public ShardedTransactionImpl(IShardedSessionImplementor shardedSession, IsolationLevel isolationLevel) { this.shardedSession = shardedSession; this.currentIsolationLevel = isolationLevel; }
private void AfterTransactionCompletion(bool? success) { if (this.shardedSession != null) { shardedSession.AfterTransactionCompletion(this, success); this.shardedSession = null; } begun = false; NotifyLocalSynchsAfterTransactionCompletion(success); }
internal static ICriteria GetExecutableCriteria(this DetachedCriteria criteria, IShardedSessionImplementor shardedSession) { Preconditions.CheckNotNull(criteria); Preconditions.CheckNotNull(shardedSession); return(ToShardedCriteria(GetCriteriaImpl(criteria), shardedSession)); }
/// <summary> /// Creates new <see cref="ShardedQueryImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> public ShardedBatch(IShardedSessionImplementor session) { this.session = session; }
/// <summary> /// Creates new <see cref="ShardedQueryImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> public ShardedMultiQueryImpl(IShardedSessionImplementor session) { this.session = session; }
/// <summary> /// Creates new <see cref="ShardedCriteriaImpl"/> instance. /// </summary> /// <param name="session">The Sharded session on which this query is to be executed.</param> public ShardedMultiCriteriaImpl(IShardedSessionImplementor session) { this.session = session; }