public virtual IList List(CriteriaImpl criteria) { using (new SessionIdLoggingContext(SessionId)) { var results = new List <object>(); List(criteria, results); return(results); } }
public virtual async Task <IList> ListAsync(CriteriaImpl criteria, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (new SessionIdLoggingContext(SessionId)) { var results = new List <object>(); await(ListAsync(criteria, results, cancellationToken)).ConfigureAwait(false); return(results); } }
public override IList List(CriteriaImpl criteria) { using (new SessionIdLoggingContext(SessionId)) { // TODO pull up ArrayList results = new ArrayList(); List(criteria, results); return(results); } }
public override IList <T> List <T>(CriteriaImpl criteria) { using (new SessionIdLoggingContext(SessionId)) { // TODO pull up List <T> results = new List <T>(); List(criteria, results); return(results); } }
public virtual async Task <IList <T> > ListAsync <T>(CriteriaImpl criteria, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (BeginProcess()) { var results = new List <T>(); await(ListAsync(criteria, results, cancellationToken)).ConfigureAwait(false); return(results); } }
��������public object Clone() �������� { ������������CriteriaImpl clone; ������������if(persistentClass != null) ������������ { ����������������clone = new CriteriaImpl(persistentClass, Alias, Session); ������������ } ������������else ������������ { ����������������clone = new CriteriaImpl(entityOrClassName, Alias, Session); ������������ } ������������CloneSubcriteria(clone); ������������foreach(KeyValuePair <string, FetchMode> de in fetchModes) ������������ { ����������������clone.fetchModes.Add(de.Key, de.Value); ������������ } ������������foreach(KeyValuePair <string, LockMode> de in lockModes) ������������ { ����������������clone.lockModes.Add(de.Key, de.Value); ������������ } ������������clone.maxResults = maxResults; ������������clone.firstResult = firstResult; ������������clone.timeout = timeout; ������������clone.fetchSize = fetchSize; ������������clone.cacheable = cacheable; ������������clone.cacheRegion = cacheRegion; ������������clone.SetProjection(projection); ������������CloneProjectCrtieria(clone); ������������clone.SetResultTransformer(resultTransformer); ������������clone.comment = comment; ������������if(flushMode.HasValue) ������������ { ����������������clone.SetFlushMode(flushMode.Value); ������������ } ������������if(cacheMode.HasValue) ������������ { ����������������clone.SetCacheMode(cacheMode.Value); ������������ } ������������return clone; �������� }
internal Subcriteria(CriteriaImpl root, ICriteria parent, string path, string alias, JoinType joinType, ICriterion withClause) { this.root = root; this.parent = parent; this.alias = alias; this.path = path; this.joinType = joinType; this.withClause = withClause; root.subcriteriaList.Add(this); root.subcriteriaByPath[path] = this; SetAlias(alias); }
private void CloneProjectCrtieria(CriteriaImpl clone) { if (projectionCriteria != null) { if (projectionCriteria == this) { clone.projectionCriteria = clone; } else { ICriteria clonedProjectionCriteria = (ICriteria)projectionCriteria.Clone(); clone.projectionCriteria = clonedProjectionCriteria; } } }
internal Subcriteria(CriteriaImpl root, ICriteria parent, string path, string alias, JoinType joinType, ICriterion withClause, string joinEntityName = null) { this.root = root; this.parent = parent; this.alias = alias; this.path = path; this.joinType = joinType; this.withClause = withClause; JoinEntityName = joinEntityName; hasRestrictions = withClause != null; root.subcriteriaList.Add(this); root.subcriteriaByPath[path] = this; SetAlias(alias); }
internal Subcriteria(CriteriaImpl root, ICriteria parent, string path, string alias, JoinType joinType) { this.root = root; this.parent = parent; this.alias = alias; this.path = path; this.joinType = joinType; root.subcriteriaList.Add(this); root.subcriteriaByPath[path] = this; if (alias != null) { root.subcriteriaByAlias[alias] = this; } }
private void CloneSubcriteria(CriteriaImpl clone) { //we need to preserve the parent criteria, we rely on the ordering when creating the //subcriterias initially here, so we don't need to make more than a single pass Dictionary <ICriteria, ICriteria> newParents = new Dictionary <ICriteria, ICriteria>(); newParents[this] = clone; foreach (Subcriteria subcriteria in IterateSubcriteria()) { ICriteria currentParent; if (!newParents.TryGetValue(subcriteria.Parent, out currentParent)) { throw new AssertionFailure( "Could not find parent for subcriteria in the previous subcriteria. If you see this error, it is a bug"); } Subcriteria clonedSubCriteria = new Subcriteria(clone, currentParent, subcriteria.Path, subcriteria.Alias, subcriteria.JoinType); clonedSubCriteria.SetLockMode(subcriteria.LockMode); newParents[subcriteria] = clonedSubCriteria; } // remap the orders foreach (OrderEntry orderEntry in IterateOrderings()) { ICriteria currentParent; if (!newParents.TryGetValue(orderEntry.Criteria, out currentParent)) { throw new AssertionFailure( "Could not find parent for order in the previous criteria. If you see this error, it is a bug"); } currentParent.AddOrder(orderEntry.Order); } // remap the restrictions to appropriate criterias foreach (CriterionEntry criterionEntry in criteria) { ICriteria currentParent; if (!newParents.TryGetValue(criterionEntry.Criteria, out currentParent)) { throw new AssertionFailure( "Could not find parent for restriction in the previous criteria. If you see this error, it is a bug."); } currentParent.Add(criterionEntry.Criterion); } }
public override async Task <IList <T> > ListAsync <T>(CriteriaImpl criteria, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (BeginProcess()) { // We need to flush the batcher. Otherwise it may have pending operations which will not already have reached the database, // and the query may yield stale data. await(FlushAsync(cancellationToken)).ConfigureAwait(false); string[] implementors = Factory.GetImplementors(criteria.EntityOrClassName); int size = implementors.Length; CriteriaLoader[] loaders = new CriteriaLoader[size]; for (int i = 0; i < size; i++) { loaders[size - 1 - i] = new CriteriaLoader(GetOuterJoinLoadable(implementors[i]), Factory, criteria, implementors[i], EnabledFilters); } bool success = false; try { var results = await(loaders.LoadAllToListAsync <T>(this, cancellationToken)).ConfigureAwait(false); success = true; return(results); } catch (OperationCanceledException) { throw; } catch (HibernateException) { // Do not call Convert on HibernateExceptions throw; } catch (Exception sqle) { throw Convert(sqle, "Unable to perform find"); } finally { await(AfterOperationAsync(success, cancellationToken)).ConfigureAwait(false); temporaryPersistenceContext.Clear(); } } }
public object Clone() { CriteriaImpl clone; if (persistentClass != null) { clone = new CriteriaImpl(persistentClass, Alias, Session); } else { clone = new CriteriaImpl(entityOrClassName, Alias, Session); } CloneSubcriteria(clone); foreach (KeyValuePair <string, FetchMode> de in fetchModes) { clone.fetchModes.Add(de.Key, de.Value); } foreach (KeyValuePair <string, LockMode> de in lockModes) { clone.lockModes.Add(de.Key, de.Value); } clone.maxResults = maxResults; clone.firstResult = firstResult; clone.timeout = timeout; clone.fetchSize = fetchSize; clone.cacheable = cacheable; clone.cacheRegion = cacheRegion; clone.SetProjection(projection); CloneProjectCrtieria(clone); clone.SetResultTransformer(resultTransformer); clone.comment = comment; clone.readOnly = readOnly; if (flushMode.HasValue) { clone.SetFlushMode(flushMode.Value); } if (cacheMode.HasValue) { clone.SetCacheMode(cacheMode.Value); } return(clone); }
public override async Task ListAsync(CriteriaImpl criteria, IList results, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); using (new SessionIdLoggingContext(SessionId)) { CheckAndUpdateSessionStatus(); string[] implementors = Factory.GetImplementors(criteria.EntityOrClassName); int size = implementors.Length; CriteriaLoader[] loaders = new CriteriaLoader[size]; for (int i = 0; i < size; i++) { loaders[i] = new CriteriaLoader(GetOuterJoinLoadable(implementors[i]), Factory, criteria, implementors[i], EnabledFilters); } bool success = false; try { for (int i = size - 1; i >= 0; i--) { ArrayHelper.AddAll(results, await(loaders[i].ListAsync(this, cancellationToken)).ConfigureAwait(false)); } success = true; } catch (HibernateException) { // Do not call Convert on HibernateExceptions throw; } catch (Exception sqle) { throw Convert(sqle, "Unable to perform find"); } finally { await(AfterOperationAsync(success, cancellationToken)).ConfigureAwait(false); } temporaryPersistenceContext.Clear(); } }
��������private void CloneProjectCrtieria(CriteriaImpl clone) �������� { ������������if(projectionCriteria != null) ������������ { ����������������if(projectionCriteria == this) ���������������� { ��������������������clone.projectionCriteria = clone; ���������������� } ����������������else ���������������� { ��������������������ICriteria clonedProjectionCriteria = (ICriteria)projectionCriteria.Clone(); ��������������������clone.projectionCriteria = clonedProjectionCriteria; ���������������� } ������������ } �������� }
������������internal Subcriteria(CriteriaImpl root, ICriteria parent, string path, string alias, JoinType joinType, ICriterion withClause) ������������ { ����������������this.root = root; ����������������this.parent = parent; ����������������this.alias = alias; ����������������this.path = path; ����������������this.joinType = joinType; ����������������this.withClause = withClause; � ����������������root.subcriteriaList.Add(this); � ����������������root.subcriteriaByPath[path] = this; ����������������if(alias != null) ���������������� { ��������������������root.subcriteriaByAlias[alias] = this; ���������������� } ������������ }
public override void List(CriteriaImpl criteria, IList results) { using (BeginProcess()) { string[] implementors = Factory.GetImplementors(criteria.EntityOrClassName); int size = implementors.Length; CriteriaLoader[] loaders = new CriteriaLoader[size]; for (int i = 0; i < size; i++) { loaders[i] = new CriteriaLoader(GetOuterJoinLoadable(implementors[i]), Factory, criteria, implementors[i], EnabledFilters); } bool success = false; try { for (int i = size - 1; i >= 0; i--) { ArrayHelper.AddAll(results, loaders[i].List(this)); } success = true; } catch (HibernateException) { // Do not call Convert on HibernateExceptions throw; } catch (Exception sqle) { throw Convert(sqle, "Unable to perform find"); } finally { AfterOperation(success); } temporaryPersistenceContext.Clear(); } }
protected virtual IList GetResultList(IList results) { if (resultTransformer != null) { for (int i = 0; i < results.Count; i++) { results[i] = resultTransformer.TransformList((IList)results[i]); } } else { for (int i = 0; i < results.Count; i++) { CriteriaImpl critImp = criteriaQueries[i] as CriteriaImpl; if (critImp == null || critImp.ResultTransformer == null) { continue; } results[i] = critImp.ResultTransformer.TransformList((IList)results[i]); } } return(results); }
/// <summary> /// Copy all the internal attributes of the given CriteriaImpl /// except alter the root persistent class type to be the given one. /// </summary> /// <param name="persistentClass"></param> /// <param name="original"></param> public CriteriaImpl(System.Type persistentClass, CriteriaImpl original) { this.persistentClass = persistentClass; this.classByAlias = original.classByAlias; this.classByAlias[CriteriaUtil.RootAlias] = persistentClass; this.criteria = original.criteria; this.orderings = original.orderings; this.fetchModes = original.fetchModes; this.associationPathByAlias = original.associationPathByAlias; this.aliasByAssociationPath = original.aliasByAssociationPath; this.lockModes = original.lockModes; this.maxResults = original.maxResults; this.firstResult = original.firstResult; this.timeout = original.timeout; this.fetchSize = original.fetchSize; this.session = original.session; this.resultTransformer = original.resultTransformer; this.counter = original.counter; this.cacheable = original.cacheable; this.cacheRegion = original.cacheRegion; }
������������internal Subcriteria(CriteriaImpl root, ICriteria parent, string path, JoinType joinType) ���������������� : this(root, parent, path, null, joinType) { }
public override IList <T> List <T>(CriteriaImpl criteria);
public abstract Task ListAsync(CriteriaImpl criteria, IList results, CancellationToken cancellationToken);
//{ // ArrayHelper.AddAll(results, List(criteria)); //} public virtual async Task <IList> ListAsync(CriteriaImpl criteria, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); return((await(ListAsync <object>(criteria, cancellationToken)).ConfigureAwait(false)).ToIList()); }
internal Subcriteria(CriteriaImpl root, ICriteria parent, string path, string alias, JoinType joinType) : this(root, parent, path, alias, joinType, null) { }
public override IList List(CriteriaImpl criteria);
internal Subcriteria(CriteriaImpl parent, string rootAlias, string rootPath) { this.parent = parent; this.rootAlias = rootAlias; this.rootPath = rootPath; }
public override void List(CriteriaImpl criteria, IList results);
//TODO 6.0: Remove (use base class implementation) public override async Task ListAsync(CriteriaImpl criteria, IList results, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ArrayHelper.AddAll(results, await(ListAsync(criteria, cancellationToken)).ConfigureAwait(false)); }
//TODO 6.0: Remove (use base class implementation) public override void List(CriteriaImpl criteria, IList results) { ArrayHelper.AddAll(results, List(criteria)); }
public abstract void List(CriteriaImpl criteria, IList results);