public AuditRevisionsAssociationQuery(AuditConfiguration auditConfiguration,
                                              IAuditReaderImplementor auditReader,
                                              IEntityAuditQuery <TEntity> parent,
                                              QueryBuilder queryBuilder,
                                              string ownerEntityName,
                                              string propertyName,
                                              JoinType joinType,
                                              string ownerAlias)
        {
            _auditConfiguration = auditConfiguration;
            _auditReader        = auditReader;
            _parent             = parent;
            _queryBuilder       = queryBuilder;
            _joinType           = joinType;
            _ownerAlias         = ownerAlias;

            var relationDescription = CriteriaTools.GetRelatedEntity(auditConfiguration, ownerEntityName, propertyName);

            if (relationDescription == null)
            {
                throw new ArgumentException("Property " + propertyName + " of entity " + ownerEntityName + " is not a valid association for queries");
            }
            _entityName = relationDescription.ToEntityName;
            _ownerAssociationIdMapper = relationDescription.IdMapper;
            _alias               = queryBuilder.GenerateAlias();
            _parameters          = queryBuilder.AddParameters(_alias);
            _criterions          = new List <IAuditCriterion>();
            _associationQueries  = new List <AuditRevisionsAssociationQuery <TEntity> >();
            _associationQueryMap = new Dictionary <string, AuditRevisionsAssociationQuery <TEntity> >();
        }
        public IEntityAuditQuery <TEntity> AddOrder(IAuditOrder order)
        {
            _hasOrders = true;
            var orderData    = order.GetData(_auditConfiguration);
            var propertyName = CriteriaTools.DeterminePropertyName(_auditConfiguration, _auditReader, _entityName, orderData.Item1);

            _queryBuilder.AddOrder(_alias, propertyName, orderData.Item2);
            return(this);
        }
        public IEntityAuditQuery <TEntity> AddOrder(IAuditOrder order)
        {
            _hasOrder = true;
            var orderData    = order.GetData(AuditConfiguration);
            var propertyName = CriteriaTools.DeterminePropertyName(AuditConfiguration, _versionsReader, EntityName, orderData.Item1);

            QueryBuilder.AddOrder(QueryConstants.ReferencedEntityAlias, propertyName, orderData.Item2);
            return(this);
        }
        public IAuditQuery AddOrder(IAuditOrder order)
        {
            HasOrder = true;
            var orderData    = order.GetData(VerCfg);
            var propertyName = CriteriaTools.DeterminePropertyName(VerCfg, VersionsReader, EntityName, orderData.Item1);

            QueryBuilder.AddOrder(propertyName, orderData.Item2);
            return(this);
        }
        public IEntityAuditQuery <TEntity> AddOrder(IAuditOrder order)
        {
            hasOrder = true;
            var orderData    = order.GetData(auditConfiguration);
            var propertyName = CriteriaTools.DeterminePropertyName(AuditConfiguration, versionsReader, entityName, orderData.Item1);

            queryBuilder.AddOrder(propertyName, orderData.Item2);
            return(this);
        }
        public IAuditQuery AddProjection(IAuditProjection projection)
        {
            var projectionData = projection.GetData(VerCfg);

            HasProjection = true;
            var propertyName = CriteriaTools.DeterminePropertyName(VerCfg, VersionsReader, EntityName, projectionData.Item2);

            QueryBuilder.AddProjection(projectionData.Item1, propertyName, projectionData.Item3);
            return(this);
        }
        public IAuditQuery AddProjection(IAuditProjection projection)
        {
            _hasProjections = true;
            var projectionData = projection.GetData(_auditConfiguration);
            var propertyName   = CriteriaTools.DeterminePropertyName(_auditConfiguration, _auditReader, _entityName, projectionData.Item2);

            _queryBuilder.AddProjection(projectionData.Item1, _alias, propertyName, projectionData.Item3);
            RegisterProjection(_entityName, projection);
            return(this);
        }
        public IAuditQuery AddProjection(IAuditProjection projection)
        {
            var projectionData = projection.GetData(VerCfg);

            RegisterProjection(EntityName, projection);
            var propertyName = CriteriaTools.DeterminePropertyName(VerCfg, VersionsReader, EntityName, projectionData.Item2);

            QueryBuilder.AddProjection(projectionData.Item1, QueryConstants.ReferencedEntityAlias, propertyName, projectionData.Item3);
            return(this);
        }