///////////////////////////////////////////////////////////////
// This is generated code.
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.0.0.0
// Code is generated on: Saturday, February 24, 2007 10:00:21 PM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version:
//////////////////////////////////////////////////////////////
using System;
using System.Data;
using System.Data.Common;
using DataFeedFrameworkDAL.EntityClasses;
using DataFeedFrameworkDAL.FactoryClasses;
using DataFeedFrameworkDAL.CollectionClasses;
using DataFeedFrameworkDAL.HelperClasses;
using DataFeedFrameworkDAL;
using SD.LLBLGen.Pro.ORMSupportClasses;
using SD.LLBLGen.Pro.DQE.SqlServer;
namespace DataFeedFrameworkDAL.DaoClasses
{
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
// __LLBLGENPRO_USER_CODE_REGION_END
///
/// General DAO class for the Snippet Entity. It will perform database oriented actions for
/// a entity of type 'SnippetEntity'. This DAO works on an EntityFields object.
///
public partial class SnippetDAO : DaoBase
{
/// CTor
public SnippetDAO() : base(InheritanceInfoProviderSingleton.GetInstance(), new DynamicQueryEngine(), InheritanceHierarchyType.None, "SnippetEntity", new SnippetEntityFactory())
{
}
/// CTor
/// Inheritance info provider to use.
/// Dqe to use.
/// Type of inheritance.
/// Name of the entity.
/// Entity factory.
internal SnippetDAO(IInheritanceInfoProvider inheritanceInfoProviderToUse, DynamicQueryEngineBase dqeToUse, InheritanceHierarchyType typeOfInheritance, string entityName, IEntityFactory entityFactory) : base(inheritanceInfoProviderToUse, dqeToUse, typeOfInheritance, entityName, entityFactory)
{
}
///
/// Retrieves in the calling SnippetCollection object all SnippetEntity objects which have data in common
/// with the specified related Entities. If one is omitted, that entity is not used as a filter.
///
/// A containing transaction, if caller is added to a transaction, or null if not.
/// Collection to fill with the entity objects retrieved
/// 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.
/// The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.
/// The EntityFactory to use when creating entity objects during a GetMulti() call.
/// Extra filter to limit the resultset. Predicate expression can be null, in which case it will be ignored.
/// SnippetGroupEntity instance to use as a filter for the SnippetEntity objects to return
/// The page number to retrieve.
/// The page size of the page to retrieve.
public bool GetMulti(ITransaction containingTransaction, IEntityCollection collectionToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IPredicateExpression filter, IEntity snippetGroupInstance, int pageNumber, int pageSize)
{
base.EntityFactoryToUse = entityFactoryToUse;
IEntityFields fieldsToReturn = EntityFieldsFactory.CreateEntityFieldsObject(DataFeedFrameworkDAL.EntityType.SnippetEntity);
IPredicateExpression selectFilter = CreateFilterUsingForeignKeys(snippetGroupInstance, fieldsToReturn);
if(filter!=null)
{
selectFilter.AddWithAnd(filter);
}
return base.PerformGetMultiAction(containingTransaction, collectionToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, null, pageNumber, pageSize);
}
///
/// Retrieves entities of the type 'SnippetEntity' in a datatable which match the specified filter.
/// It will always create a new connection to the database.
///
/// 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.
/// The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.
/// A predicate or predicate expression which should be used as filter for the entities to retrieve.
/// The set of relations to walk to construct to total query.
/// The page number to retrieve.
/// The page size of the page to retrieve.
/// a filled datatable if succeeded, false otherwise
public virtual DataTable GetMultiAsDataTable(long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, int pageNumber, int pageSize)
{
IEntityFields fieldsToReturn = EntityFieldsFactory.CreateEntityFieldsObject(DataFeedFrameworkDAL.EntityType.SnippetEntity);
return base.PerformGetMultiAsDataTableAction(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize);
}
///
/// Deletes from the persistent storage all 'Snippet' entities which have data in common
/// with the specified related Entities. If one is omitted, that entity is not used as a filter.
///
/// A containing transaction, if caller is added to a transaction, or null if not.
/// SnippetGroupEntity instance to use as a filter for the SnippetEntity objects to delete
/// Amount of entities affected, if the used persistent storage has rowcounting enabled.
public int DeleteMulti(ITransaction containingTransaction, IEntity snippetGroupInstance)
{
IEntityFields fields = EntityFieldsFactory.CreateEntityFieldsObject(DataFeedFrameworkDAL.EntityType.SnippetEntity);
IPredicateExpression deleteFilter = CreateFilterUsingForeignKeys(snippetGroupInstance, fields);
return base.DeleteMulti(containingTransaction, deleteFilter);
}
///
/// Updates all entities of the same type or subtype of the entity entityWithNewValues directly in the persistent storage if they match the filter
/// supplied in filterBucket. Only the fields changed in entityWithNewValues are updated for these fields. Entities of a subtype of the type
/// of entityWithNewValues which are affected by the filterBucket's filter will thus also be updated.
///
/// IEntity instance which holds the new values for the matching entities to update. Only changed fields are taken into account
/// A containing transaction, if caller is added to a transaction, or null if not.
/// SnippetGroupEntity instance to use as a filter for the SnippetEntity objects to update
/// Amount of entities affected, if the used persistent storage has rowcounting enabled.
public int UpdateMulti(IEntity entityWithNewValues, ITransaction containingTransaction, IEntity snippetGroupInstance)
{
IEntityFields fields = EntityFieldsFactory.CreateEntityFieldsObject(DataFeedFrameworkDAL.EntityType.SnippetEntity);
IPredicateExpression updateFilter = CreateFilterUsingForeignKeys(snippetGroupInstance, fields);
return base.UpdateMulti(entityWithNewValues, containingTransaction, updateFilter);
}
///
/// Determines the connection to use. If transaction to use is null, a new connection is created, otherwise the connection of the transaction is used.
///
/// Transaction to use.
/// a ready to use connection object.
protected override IDbConnection DetermineConnectionToUse(ITransaction transactionToUse)
{
return DbUtils.DetermineConnectionToUse(transactionToUse);
}
///
/// Creates a new ADO.NET data adapter.
///
/// ready to use ADO.NET data-adapter
protected override DbDataAdapter CreateDataAdapter()
{
return DbUtils.CreateDataAdapter();
}
///
/// Creates a PredicateExpression which should be used as a filter when any combination of available foreign keys is specified.
///
/// SnippetGroupEntity instance to use as a filter for the SnippetEntity objects
/// IEntityFields implementation which forms the definition of the fieldset of the target entity.
/// A ready to use PredicateExpression based on the passed in foreign key value holders.
private IPredicateExpression CreateFilterUsingForeignKeys(IEntity snippetGroupInstance, IEntityFields fieldsToReturn)
{
IPredicateExpression selectFilter = new PredicateExpression();
if(snippetGroupInstance != null)
{
selectFilter.Add(new FieldCompareValuePredicate(fieldsToReturn[(int)SnippetFieldIndex.SnippetGroupId], ComparisonOperator.Equal, ((SnippetGroupEntity)snippetGroupInstance).SnippetGroupId));
}
return selectFilter;
}
#region Custom DAO code
// __LLBLGENPRO_USER_CODE_REGION_START CustomDAOCode
// __LLBLGENPRO_USER_CODE_REGION_END
#endregion
#region Included Code
#endregion
}
}