/// <summary> Fetches the contents of this entity from the persistent storage using the primary key specified in a polymorphic way, so the entity returned /// could be of a subtype of the current entity or the current entity.</summary> /// <param name="transactionToUse">transaction to use during fetch</param> /// <param name="id">PK value for Condition which data should be fetched into this Condition object</param> /// <param name="contextToUse">Context to use for fetch</param> /// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. /// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property /// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param> /// <returns>Fetched entity of the type of this entity or a subtype, or an empty entity of that type if not found.</returns> /// <remarks>Creates a new instance, doesn't fill <i>this</i> entity instance</remarks> public static new ConditionEntity FetchPolymorphic(ITransaction transactionToUse, System.Int32 id, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) { ConditionDAO dao = new ConditionDAO(); IEntityFields fields = EntityFieldsFactory.CreateEntityFieldsObject(policyDB.EntityType.ConditionEntity); fields[(int)ConditionFieldIndex.Id].ForcedCurrentValueWrite(id); return((ConditionEntity)dao.FetchExistingPolymorphic(transactionToUse, fields, contextToUse, excludedIncludedFields)); }
/// <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(ConditionFieldIndex 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; } ConditionDAO dao = DAOFactory.CreateConditionDAO(); 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> /// <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) { ConditionDAO dao = DAOFactory.CreateConditionDAO(); return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize)); }
/// <summary> Fetches the contents of this entity from the persistent storage using the primary key specified in a polymorphic way, so the entity returned /// could be of a subtype of the current entity or the current entity.</summary> /// <param name="transactionToUse">transaction to use during fetch</param> /// <param name="id">PK value for Condition which data should be fetched into this Condition object</param> /// <param name="contextToUse">Context to use for fetch</param> /// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. /// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property /// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param> /// <returns>Fetched entity of the type of this entity or a subtype, or an empty entity of that type if not found.</returns> /// <remarks>Creates a new instance, doesn't fill <i>this</i> entity instance</remarks> public static new ConditionEntity FetchPolymorphic(ITransaction transactionToUse, System.Int32 id, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields) { ConditionDAO dao = new ConditionDAO(); IEntityFields fields = EntityFieldsFactory.CreateEntityFieldsObject(policyDB.EntityType.ConditionEntity); fields[(int)ConditionFieldIndex.Id].ForcedCurrentValueWrite(id); return (ConditionEntity)dao.FetchExistingPolymorphic(transactionToUse, fields, contextToUse, excludedIncludedFields); }
/// <summary> Performs the insert action of a new Entity to the persistent storage.</summary> /// <returns>true if succeeded, false otherwise</returns> protected override bool InsertEntity() { ConditionDAO dao = (ConditionDAO)CreateDAOInstance(); return(dao.AddNew(base.Fields, base.Transaction)); }