예제 #1
0
 /// <summary>
 /// Retrieves entities of the type 'MUserEntity' in a datatable which match the specified filter. 
 /// It will always create a new connection to the database.
 /// </summary>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. 
 /// If the used Dynamic Query Engine supports it, 'TOP' is used to limit the amount of rows to return. 
 /// When set to 0, no limitations are specified.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
 /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
 /// <param name="relations">The set of relations to walk to construct to total query.</param>
 /// <param name="pageNumber">The page number to retrieve.</param>
 /// <param name="pageSize">The page size of the page to retrieve.</param>
 /// <returns>a filled datatable if succeeded, false otherwise</returns>
 public virtual DataTable GetMultiAsDataTable(long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, int pageNumber, int pageSize)
 {
     return base.PerformGetMultiAsDataTableAction(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize);
 }
 /// <summary>
 /// Retrieves entities of the type 'AttributeMatchEntity' in a datatable which match the specified filter.
 /// It will always create a new connection to the database.
 /// </summary>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.
 /// If the used Dynamic Query Engine supports it, 'TOP' is used to limit the amount of rows to return.
 /// When set to 0, no limitations are specified.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
 /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
 /// <param name="relations">The set of relations to walk to construct to total query.</param>
 /// <param name="pageNumber">The page number to retrieve.</param>
 /// <param name="pageSize">The page size of the page to retrieve.</param>
 /// <returns>a filled datatable if succeeded, false otherwise</returns>
 public virtual DataTable GetMultiAsDataTable(long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, int pageNumber, int pageSize)
 {
     return(base.PerformGetMultiAsDataTableAction(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
 }
예제 #3
0
 /// <summary>
 /// Retrieves rows in the datatable provided which match the specified filter, containing the fields specified. It will always create a new connection to the database.
 /// </summary>
 /// <param name="fieldsToReturn">IEntityFields implementation which forms the definition of the resultset to return.</param>
 /// <param name="tableToFill">The datatable to fill with the rows retrieved</param>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. 
 /// If the used Dynamic Query Engine supports it, 'TOP' is used to limit the amount of rows to return. When set to 0, no limitations are specified.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When null is specified, no sorting is applied.</param>
 /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
 /// <param name="relations">The set of relations to walk to construct to total query.</param>
 /// <param name="allowDuplicates">Flag to allow duplicate rows or not</param>
 /// <param name="groupByClause">The list of fields to group by on. When not specified or an empty collection is specified, no group by clause
 /// is added to the query. A check is performed for each field in the selectList. If a field in the selectList is not present in the groupByClause collection, an exception is thrown.</param>
 /// <param name="transactionToUse">The transaction object to use. Can be null. If specified, the connection object of the transaction is used to fill the TypedView, which avoids deadlocks on SqlServer.</param>
 /// <param name="pageNumber">The page number to retrieve.</param>
 /// <param name="pageSize">The page size of the page to retrieve.</param>
 /// <returns>true if succeeded, false otherwise</returns>
 public bool GetMultiAsDataTable(IEntityFields fieldsToReturn, DataTable tableToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, bool allowDuplicates, IGroupByCollection groupByClause, ITransaction transactionToUse, int pageNumber, int pageSize)
 {
     return base.PerformGetMultiAsDataTableAction(fieldsToReturn, tableToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, allowDuplicates, groupByClause, transactionToUse, pageNumber, pageSize);
 }
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            AnalysisResultDAO dao = DAOFactory.CreateAnalysisResultDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }
        /// <summary> Gets a scalar value, calculated with the aggregate and expression specified. the field index specified is the field the expression and aggregate are applied on.</summary>
        /// <param name="fieldIndex">Field index of field to which to apply the aggregate function and expression</param>
        /// <param name="expressionToExecute">The expression to execute. Can be null</param>
        /// <param name="aggregateToApply">Aggregate function to apply. </param>
        /// <param name="filter">The filter to apply to retrieve the scalar</param>
        /// <param name="relations">The relations to walk</param>
        /// <param name="groupByClause">The groupby clause to apply to retrieve the scalar</param>
        /// <returns>the scalar value requested</returns>
        public virtual object GetScalar(AnalysisResultFieldIndex fieldIndex, IExpression expressionToExecute, AggregateFunction aggregateToApply, IPredicate filter, IRelationCollection relations, IGroupByCollection groupByClause)
        {
            EntityFields fields = new EntityFields(1);

            fields[0] = EntityFieldFactory.Create(fieldIndex);
            if ((fields[0].ExpressionToApply == null) || (expressionToExecute != null))
            {
                fields[0].ExpressionToApply = expressionToExecute;
            }
            if ((fields[0].AggregateFunctionToApply == AggregateFunction.None) || (aggregateToApply != AggregateFunction.None))
            {
                fields[0].AggregateFunctionToApply = aggregateToApply;
            }
            return(DAOFactory.CreateAnalysisResultDAO().GetScalar(fields, this.Transaction, filter, relations, groupByClause));
        }
        /// <summary> Gets a scalar value, calculated with the aggregate and expression specified. the field index specified is the field the expression and aggregate are applied on.</summary>
        /// <param name="fieldIndex">Field index of field to which to apply the aggregate function and expression</param>
        /// <param name="expressionToExecute">The expression to execute. Can be null</param>
        /// <param name="aggregateToApply">Aggregate function to apply. </param>
        /// <param name="filter">The filter to apply to retrieve the scalar</param>
        /// <param name="relations">The relations to walk</param>
        /// <param name="groupByClause">The groupby clause to apply to retrieve the scalar</param>
        /// <returns>the scalar value requested</returns>
        public virtual object GetScalar(ObserverDataSetFieldIndex fieldIndex, IExpression expressionToExecute, AggregateFunction aggregateToApply, IPredicate filter, IRelationCollection relations, IGroupByCollection groupByClause)
        {
            EntityFields fields = new EntityFields(1);

            fields[0] = EntityFieldFactory.Create(fieldIndex);
            if ((fields[0].ExpressionToApply == null) || (expressionToExecute != null))
            {
                fields[0].ExpressionToApply = expressionToExecute;
            }
            if ((fields[0].AggregateFunctionToApply == AggregateFunction.None) || (aggregateToApply != AggregateFunction.None))
            {
                fields[0].AggregateFunctionToApply = aggregateToApply;
            }
            ObserverDataSetDAO dao = DAOFactory.CreateObserverDataSetDAO();

            return(dao.GetScalar(fields, base.Transaction, filter, relations, groupByClause));
        }
 /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
 /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
 /// <param name="relations">The set of relations to walk to construct to total query.</param>
 /// <returns>DataTable with the rows requested.</returns>
 public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations)
 {
     return(GetMultiAsDataTable(selectFilter, maxNumberOfItemsToReturn, sortClauses, relations, 0, 0));
 }
 /// <summary> Deletes from the persistent storage all AuditInfo entities which match with the specified filter, formulated in the predicate or predicate expression definition.</summary>
 /// <param name="deleteFilter">A predicate or predicate expression which should be used as filter for the entities to delete.</param>
 /// <param name="relations">The set of relations to walk to construct the total query.</param>
 /// <returns>Amount of entities affected, if the used persistent storage has rowcounting enabled.</returns>
 public override int DeleteMulti(IPredicate deleteFilter, IRelationCollection relations)
 {
     throw new NotSupportedException("This method isn't supported for this entity");
 }
 /// <summary>Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
 /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
 /// <param name="relations">The set of relations to walk to construct to total query.</param>
 /// <param name="pageNumber">The page number to retrieve.</param>
 /// <param name="pageSize">The page size of the page to retrieve.</param>
 /// <returns>DataTable with the rows requested.</returns>
 public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
 {
     return(DAOFactory.CreateAuditActionTypeDAO().GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
 }
        /// <summary>
        /// Creates a new Select Query which is ready to use, based on the specified select list and the specified set of relations.
        /// If selectFilter is set to null, all rows are selected.
        /// </summary>
        /// <param name="selectList">list of IEntityFieldCore objects to select</param>
        /// <param name="fieldsPersistenceInfo">Array of IFieldPersistenceInfo objects to use to build the select query</param>
        /// <param name="connectionToUse">The connection to use for the query</param>
        /// <param name="selectFilter">A complete IPredicate implementing object which contains the filter for the rows to select. When set to null, no
        /// filtering is done, and all rows are returned.</param>
        /// <param name="rowsToSkip">The rows to skip. Default 0</param>
        /// <param name="rowsToTake">The rows to take. Default 0, which means all.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relationsToWalk">list of EntityRelation objects, which will be used to formulate a FROM clause with INNER JOINs.</param>
        /// <param name="allowDuplicates">Flag which forces the inclusion of DISTINCT if set to true. If the resultset contains fields of type ntext, text or image, no duplicate filtering
        /// is done.</param>
        /// <param name="groupByClause">The list of fields to group by on. When not specified or an empty collection is specified, no group by clause
        /// is added to the query. A check is performed for each field in the selectList. If a field in the selectList is not present in the groupByClause
        /// collection, an exception is thrown.</param>
        /// <returns>
        /// IRetrievalQuery instance which is ready to be used.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">When selectList is null or fieldsPersistenceInfo is null or relationsToWalk is null</exception>
        /// <exception cref="System.ArgumentException">When selectList contains no EntityFieldCore instances or fieldsPersistenceInfo is empty.</exception>
        /// <remarks>
        /// Generic version
        /// </remarks>
        protected override IRetrievalQuery CreatePagingSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo,
                                                                DbConnection connectionToUse, IPredicate selectFilter, int rowsToSkip, int rowsToTake,
                                                                ISortExpression sortClauses, IRelationCollection relationsToWalk, bool allowDuplicates,
                                                                IGroupByCollection groupByClause)
        {
            TraceHelper.WriteLineIf(Switch.TraceInfo, "CreatePagingSelectDQ", "Method Enter");

            long max            = 0;
            bool pagingRequired = true;

            if (rowsToSkip <= 0)
            {
                // no paging.
                max            = rowsToTake;
                pagingRequired = false;
            }

            IRetrievalQuery normalQuery = this.CreateSelectDQ(selectList, fieldsPersistenceInfo, connectionToUse, selectFilter, max, sortClauses, relationsToWalk, allowDuplicates, groupByClause);

            if (!pagingRequired)
            {
                TraceHelper.WriteLineIf(Switch.TraceInfo, "CreatePagingSelectDQ: no paging.", "Method Exit");
                return(normalQuery);
            }
            bool emitQueryToTrace = false;

            if (normalQuery.RequiresClientSideDistinctFiltering)
            {
                // manual paging required
                normalQuery.RequiresClientSidePaging = pagingRequired;
                normalQuery.ManualRowsToSkip         = rowsToSkip;
                normalQuery.ManualRowsToTake         = rowsToTake;
            }
            else
            {
                // normal paging. Embed paging logic. There is no TOP statement in the query as we've passed '0' for maxAmountOfItemsToReturn
                string upperLimitSnippet = string.Empty;
                if (rowsToTake > 0)
                {
                    upperLimitSnippet = string.Format(" TOP {0}", rowsToTake);
                }
                if (normalQuery.Command.CommandText.ToLowerInvariant().StartsWith("select distinct"))
                {
                    normalQuery.Command.CommandText = String.Format("SELECT DISTINCT{0} START AT {1} {2}",
                                                                    upperLimitSnippet, rowsToSkip + 1, normalQuery.Command.CommandText.Substring(16));
                }
                else
                {
                    normalQuery.Command.CommandText = String.Format("SELECT{0} START AT {1} {2}",
                                                                    upperLimitSnippet, rowsToSkip + 1, normalQuery.Command.CommandText.Substring(7));
                }
                emitQueryToTrace = true;
            }

            TraceHelper.WriteIf(Switch.TraceVerbose && emitQueryToTrace, normalQuery, "Generated Sql query");
            TraceHelper.WriteLineIf(Switch.TraceInfo, "CreatePagingSelectDQ", "Method Exit");
            return(normalQuery);
        }
예제 #11
0
 /// <summary>
 /// Retrieves rows in the datatable provided which match the specified filter, containing the fields specified. It will always create a new connection to the database.
 /// </summary>
 /// <param name="fieldsToReturn">IEntityFields implementation which forms the definition of the resultset to return.</param>
 /// <param name="tableToFill">The datatable to fill with the rows retrieved</param>
 /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.
 /// If the used Dynamic Query Engine supports it, 'TOP' is used to limit the amount of rows to return. When set to 0, no limitations are specified.</param>
 /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When null is specified, no sorting is applied.</param>
 /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
 /// <param name="relations">The set of relations to walk to construct to total query.</param>
 /// <param name="allowDuplicates">Flag to allow duplicate rows or not</param>
 /// <param name="groupByClause">The list of fields to group by on. When not specified or an empty collection is specified, no group by clause
 /// is added to the query. A check is performed for each field in the selectList. If a field in the selectList is not present in the groupByClause collection, an exception is thrown.</param>
 /// <param name="transactionToUse">The transaction object to use. Can be null. If specified, the connection object of the transaction is used to fill the TypedView, which avoids deadlocks on SqlServer.</param>
 /// <param name="pageNumber">The page number to retrieve.</param>
 /// <param name="pageSize">The page size of the page to retrieve.</param>
 /// <returns>true if succeeded, false otherwise</returns>
 public bool GetMultiAsDataTable(IEntityFields fieldsToReturn, DataTable tableToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, bool allowDuplicates, IGroupByCollection groupByClause, ITransaction transactionToUse, int pageNumber, int pageSize)
 {
     return(base.PerformGetMultiAsDataTableAction(fieldsToReturn, tableToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, allowDuplicates, groupByClause, transactionToUse, pageNumber, pageSize));
 }
        /// <summary>
        /// Creates a new Select Query which is ready to use, based on the specified select list and the specified set of relations.
        /// If selectFilter is set to null, all rows are selected.
        /// </summary>
        /// <param name="selectList">list of IEntityFieldCore objects to select</param>
        /// <param name="fieldsPersistenceInfo">Array of IFieldPersistenceInfo objects to use to build the select query</param>
        /// <param name="query">The query to fill.</param>
        /// <param name="selectFilter">A complete IPredicate implementing object which contains the filter for the rows to select. When set to null, no
        /// filtering is done, and all rows are returned.</param>
        /// <param name="maxNumberOfItemsToReturn">The maximum number of items to return with this retrieval query.
        /// If the used Dynamic Query Engine supports it, 'TOP' is used to limit the amount of rows to return.
        /// When set to 0, no limitations are specified.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relationsToWalk">list of EntityRelation objects, which will be used to formulate a FROM clause with INNER JOINs.</param>
        /// <param name="allowDuplicates">Flag which forces the inclusion of DISTINCT if set to true. If the resultset contains fields of type ntext, text or image, no duplicate filtering
        /// is done.</param>
        /// <param name="groupByClause">The list of fields to group by on. When not specified or an empty collection is specified, no group by clause
        /// is added to the query. A check is performed for each field in the selectList. If a field in the selectList is not present in the groupByClause
        /// collection, an exception is thrown.</param>
        /// <param name="relationsSpecified">flag to signal if relations are specified, this is a result of a check. This routine should
        /// simply assume the value of this flag is correct.</param>
        /// <param name="sortClausesSpecified">flag to signal if sortClauses are specified, this is a result of a check. This routine should
        /// simply assume the value of this flag is correct.</param>
        /// <exception cref="System.ArgumentNullException">When selectList is null or fieldsPersistenceInfo is null</exception>
        /// <exception cref="System.ArgumentException">When selectList contains no EntityFieldCore instances or fieldsPersistenceInfo is empty.</exception>
        protected override void CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo,
                                               IRetrievalQuery query, IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses,
                                               IRelationCollection relationsToWalk, bool allowDuplicates, IGroupByCollection groupByClause,
                                               bool relationsSpecified, bool sortClausesSpecified)
        {
            TraceHelper.WriteLineIf(Switch.TraceInfo, "CreateSelectDQ", "Method Enter");

            QueryFragments fragments = new QueryFragments();

            fragments.AddFragment("SELECT");
            StringPlaceHolder   distinctPlaceholder = fragments.AddPlaceHolder();
            StringPlaceHolder   topPlaceholder      = fragments.AddPlaceHolder();
            DelimitedStringList projection          = fragments.AddCommaFragmentList(false);

            UniqueList <string> fieldNamesInSelectList;
            bool distinctViolatingTypesFound;
            bool pkFieldSeen;

            AppendResultsetFields(selectList, fieldsPersistenceInfo, relationsToWalk, projection, sortClausesSpecified, allowDuplicates, true, new UniqueList <string>(),
                                  query, out fieldNamesInSelectList, out distinctViolatingTypesFound, out pkFieldSeen);

            bool resultsCouldContainDuplicates = this.DetermineIfDuplicatesWillOccur(relationsToWalk);
            bool distinctEmitted = this.HandleDistinctEmit(sortClauses, allowDuplicates, sortClausesSpecified, query, distinctPlaceholder, distinctViolatingTypesFound,
                                                           (pkFieldSeen && !resultsCouldContainDuplicates), fieldNamesInSelectList);

            bool groupByClauseSpecified = ((groupByClause != null) && (groupByClause.Count > 0));

            if (maxNumberOfItemsToReturn > 0)
            {
                // row limits are emitted always, unless duplicates are required but DISTINCT wasn't emitable. If not emitable, switch to client-side row limitation
                if (distinctEmitted || !resultsCouldContainDuplicates || groupByClauseSpecified || allowDuplicates)
                {
                    topPlaceholder.SetFormatted("TOP {0}", maxNumberOfItemsToReturn);
                }
                else
                {
                    query.RequiresClientSideLimitation = true;
                    query.ManualRowsToTake             = (int)maxNumberOfItemsToReturn;
                }
            }
            if (relationsSpecified)
            {
                fragments.AddFormatted("FROM {0}", relationsToWalk.ToQueryText());
                query.AddParameters(((RelationCollection)relationsToWalk).CustomFilterParameters);
            }
            else
            {
                var persistenceInfoToUse = fieldsPersistenceInfo.FirstOrDefault(p => p != null);
                if ((persistenceInfoToUse != null) && (persistenceInfoToUse.SourceObjectName.Length > 0))
                {
                    fragments.AddFormatted(" FROM {0}", this.Creator.CreateObjectName(persistenceInfoToUse));
                    string targetAlias = this.DetermineTargetAlias(selectList[0], relationsToWalk);
                    if (targetAlias.Length > 0)
                    {
                        fragments.AddFormatted(" {0}", this.Creator.CreateValidAlias(targetAlias));
                    }
                }
            }
            AppendWhereClause(selectFilter, fragments, query);
            AppendGroupByClause(groupByClause, fragments, query);
            AppendOrderByClause(sortClauses, fragments, query);
            query.SetCommandText(MakeParametersAnonymous(fragments.ToString(), query.Parameters));

            TraceHelper.WriteIf(Switch.TraceVerbose, query, "Generated Sql query");
            TraceHelper.WriteLineIf(Switch.TraceInfo, "CreateSelectDQ", "Method Exit");
        }
 /// <summary>
 /// Creates a new Update Query object which is ready to use. Only 'changed' EntityFieldCore are included in the update query.
 /// Primary Key fields are never updated.
 /// </summary>
 /// <param name="fields">Array of EntityFieldCore objects to use to build the insert query</param>
 /// <param name="fieldsPersistenceInfo">Array of IFieldPersistenceInfo objects to use to build the update query</param>
 /// <param name="query">The query object to fill.</param>
 /// <param name="updateFilter">A complete IPredicate implementing object which contains the filter for the rows to update</param>
 /// <param name="relationsToWalk">list of EntityRelation objects, which will be used to formulate a FROM clause with INNER JOINs.</param>
 /// <exception cref="System.ArgumentNullException">When fields is null or when updateFilter is null or
 /// when relationsToWalk is null or when fieldsPersistence is null</exception>
 /// <exception cref="System.ArgumentException">When fields contains no EntityFieldCore instances or fieldsPersistenceInfo is empty.</exception>
 protected override void CreateSingleTargetUpdateDQ(IEntityFieldCore[] fields, IFieldPersistenceInfo[] fieldsPersistenceInfo,
                                                    IActionQuery query, IPredicate updateFilter, IRelationCollection relationsToWalk)
 {
     this.CreateSingleTargetUpdateDQUsingFromClause(fields, fieldsPersistenceInfo, query, updateFilter, relationsToWalk);
     // ASA doesn't support named parameters, anonymize them
     MakeParametersAnonymous(query.Command);
 }
예제 #14
0
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            ServiceLocationAssetTypeChangeLogDAO dao = DAOFactory.CreateServiceLocationAssetTypeChangeLogDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }
        public override void AuditDirectUpdateOfEntities(IEntityCore entity, IPredicate filter, IRelationCollection relations, int numberOfEntitiesUpdated)
        {
            if (EnableDataAccessAuditing && EnableDataAccessAuditingUpdate && IsEntityAuditable(entity))
            {
                if (!IsAuditActionValid(entity))
                {
                    return;
                }
                IAuditInfoEntity auditInfo = CreateAuditInfoEntity(entity, MonoSoftware.LLBLGen.AuditType.DirectUpdateOfEntities);
                if (auditInfo == null)
                {
                    return;
                }

                auditInfo.ActionDataLog.Messages.Add(String.Format("{0} Entities of type {1} updated.", numberOfEntitiesUpdated, entity.LLBLGenProEntityName));

                if (EnableIntensiveAuditing)
                {
                    auditInfo.ActionDataLog.Data = BinarySerializer.Serialize(new Tuple <IPredicate, IRelationCollection>(filter, relations));
                }

                _auditInfoEntities.Add(entity.ObjectID, auditInfo);
            }

            //base.AuditDirectUpdateOfEntities(entity, filter, relations, numberOfEntitiesUpdated);
        }
예제 #16
0
		/// <summary>Gets a scalar value, calculated with the aggregate and expression specified. the field index specified is the field the expression and aggregate are applied on.</summary>
		/// <param name="fieldIndex">Field index of field to which to apply the aggregate function and expression</param>
		/// <param name="expressionToExecute">The expression to execute. Can be null</param>
		/// <param name="aggregateToApply">Aggregate function to apply. </param>
		/// <param name="filter">The filter to apply to retrieve the scalar</param>
		/// <param name="relations">The relations to walk</param>
		/// <param name="groupByClause">The groupby clause to apply to retrieve the scalar</param>
		/// <returns>the scalar value requested</returns>
		public virtual object GetScalar(CustomerDemographicFieldIndex fieldIndex, IExpression expressionToExecute, AggregateFunction aggregateToApply, IPredicate filter, IRelationCollection relations, IGroupByCollection groupByClause)
		{
			EntityFields fields = new EntityFields(1);
			fields[0] = EntityFieldFactory.Create(fieldIndex);
			if(expressionToExecute != null)
			{
				fields[0].ExpressionToApply = expressionToExecute;
			}
			if(aggregateToApply != AggregateFunction.None)
			{
				fields[0].AggregateFunctionToApply = aggregateToApply;
			}
			return DAOFactory.CreateCustomerDemographicDAO().GetScalar(fields, this.Transaction, filter, relations, groupByClause);
		}