@@ -0,0 +1,280 @@
//////////////////////////////////////////////////////////////
// <auto-generated>This code was generated by LLBLGen Pro 5.7.</auto-generated>
//////////////////////////////////////////////////////////////
// Code is generated on:
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System ;
using System.Collections.Generic ;
using Datalib.EntityClasses ;
using Datalib.HelperClasses ;
using Datalib.RelationClasses ;
using SD.LLBLGen.Pro.ORMSupportClasses ;
namespace Datalib.FactoryClasses
{
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
// __LLBLGENPRO_USER_CODE_REGION_END
/// <summary>general base class for the generated factories</summary>
[Serializable]
public partial class EntityFactoryBase2 < TEntity > : EntityFactoryCore2
where TEntity : EntityBase2 , IEntity2
{
private readonly Datalib . EntityType _typeOfEntity ;
private readonly bool _isInHierarchy ;
/// <summary>CTor</summary>
/// <param name="entityName">Name of the entity.</param>
/// <param name="typeOfEntity">The type of entity.</param>
/// <param name="isInHierarchy">If true, the entity of this factory is in an inheritance hierarchy, false otherwise</param>
public EntityFactoryBase2 ( string entityName , Datalib . EntityType typeOfEntity , bool isInHierarchy ) : base ( entityName )
{
_typeOfEntity = typeOfEntity ;
_isInHierarchy = isInHierarchy ;
}
/// <inheritdoc/>
public override IEntityFields2 CreateFields ( ) { return ModelInfoProviderSingleton . GetInstance ( ) . GetEntityFields ( this . ForEntityName ) ; }
/// <inheritdoc/>
public override IEntity2 CreateEntityFromEntityTypeValue ( int entityTypeValue ) { return GeneralEntityFactory . Create ( ( Datalib . EntityType ) entityTypeValue ) ; }
/// <inheritdoc/>
public override IRelationCollection CreateHierarchyRelations ( string objectAlias ) { return ModelInfoProviderSingleton . GetInstance ( ) . GetHierarchyRelations ( this . ForEntityName , objectAlias ) ; }
/// <inheritdoc/>
public override IEntityFactory2 GetEntityFactory ( object [ ] fieldValues , Dictionary < string , int > entityFieldStartIndexesPerEntity )
{
return ( IEntityFactory2 ) ModelInfoProviderSingleton . GetInstance ( ) . GetEntityFactory ( this . ForEntityName , fieldValues , entityFieldStartIndexesPerEntity ) ? ? this ;
}
/// <inheritdoc/>
public override IPredicateExpression GetEntityTypeFilter ( bool negate , string objectAlias ) { return ModelInfoProviderSingleton . GetInstance ( ) . GetEntityTypeFilter ( this . ForEntityName , objectAlias , negate ) ; }
/// <inheritdoc/>
public override IEntityCollection2 CreateEntityCollection ( ) { return new EntityCollection < TEntity > ( this ) ; }
/// <inheritdoc/>
public override IEntityFields2 CreateHierarchyFields ( )
{
return _isInHierarchy ? new EntityFields2 ( ModelInfoProviderSingleton . GetInstance ( ) . GetHierarchyFields ( this . ForEntityName ) , ModelInfoProviderSingleton . GetInstance ( ) , null ) : base . CreateHierarchyFields ( ) ;
}
/// <inheritdoc/>
protected override Type ForEntityType { get { return typeof ( TEntity ) ; } }
}
/// <summary>Factory to create new, empty TblFieldEntity objects.</summary>
[Serializable]
public partial class TblFieldEntityFactory : EntityFactoryBase2 < TblFieldEntity >
{
/// <summary>CTor</summary>
public TblFieldEntityFactory ( ) : base ( "TblFieldEntity" , Datalib . EntityType . TblFieldEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblFieldEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblQuestionEntity objects.</summary>
[Serializable]
public partial class TblQuestionEntityFactory : EntityFactoryBase2 < TblQuestionEntity >
{
/// <summary>CTor</summary>
public TblQuestionEntityFactory ( ) : base ( "TblQuestionEntity" , Datalib . EntityType . TblQuestionEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblQuestionEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblQuizEntity objects.</summary>
[Serializable]
public partial class TblQuizEntityFactory : EntityFactoryBase2 < TblQuizEntity >
{
/// <summary>CTor</summary>
public TblQuizEntityFactory ( ) : base ( "TblQuizEntity" , Datalib . EntityType . TblQuizEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblQuizEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblQuizQuestionEntity objects.</summary>
[Serializable]
public partial class TblQuizQuestionEntityFactory : EntityFactoryBase2 < TblQuizQuestionEntity >
{
/// <summary>CTor</summary>
public TblQuizQuestionEntityFactory ( ) : base ( "TblQuizQuestionEntity" , Datalib . EntityType . TblQuizQuestionEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblQuizQuestionEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblQuizTemplateEntity objects.</summary>
[Serializable]
public partial class TblQuizTemplateEntityFactory : EntityFactoryBase2 < TblQuizTemplateEntity >
{
/// <summary>CTor</summary>
public TblQuizTemplateEntityFactory ( ) : base ( "TblQuizTemplateEntity" , Datalib . EntityType . TblQuizTemplateEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblQuizTemplateEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblQuizTemplateDetailEntity objects.</summary>
[Serializable]
public partial class TblQuizTemplateDetailEntityFactory : EntityFactoryBase2 < TblQuizTemplateDetailEntity >
{
/// <summary>CTor</summary>
public TblQuizTemplateDetailEntityFactory ( ) : base ( "TblQuizTemplateDetailEntity" , Datalib . EntityType . TblQuizTemplateDetailEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblQuizTemplateDetailEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblSubjectEntity objects.</summary>
[Serializable]
public partial class TblSubjectEntityFactory : EntityFactoryBase2 < TblSubjectEntity >
{
/// <summary>CTor</summary>
public TblSubjectEntityFactory ( ) : base ( "TblSubjectEntity" , Datalib . EntityType . TblSubjectEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblSubjectEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty TblTrainingTypeEntity objects.</summary>
[Serializable]
public partial class TblTrainingTypeEntityFactory : EntityFactoryBase2 < TblTrainingTypeEntity >
{
/// <summary>CTor</summary>
public TblTrainingTypeEntityFactory ( ) : base ( "TblTrainingTypeEntity" , Datalib . EntityType . TblTrainingTypeEntity , false ) { }
/// <inheritdoc/>
protected override IEntity2 CreateImpl ( IEntityFields2 fields ) { return new TblTrainingTypeEntity ( fields ) ; }
}
/// <summary>Factory to create new, empty Entity objects based on the entity type specified. Uses entity specific factory objects</summary>
[Serializable]
public partial class GeneralEntityFactory
{
/// <summary>Creates a new, empty Entity object of the type specified</summary>
/// <param name="entityTypeToCreate">The entity type to create.</param>
/// <returns>A new, empty Entity object.</returns>
public static IEntity2 Create ( Datalib . EntityType entityTypeToCreate )
{
var factoryToUse = EntityFactoryFactory . GetFactory ( entityTypeToCreate ) ;
IEntity2 toReturn = null ;
if ( factoryToUse ! = null )
{
toReturn = factoryToUse . Create ( ) ;
}
return toReturn ;
}
}
/// <summary>Class which is used to obtain the entity factory based on the .NET type of the entity. </summary>
[Serializable]
public static class EntityFactoryFactory
{
private static Dictionary < Type , IEntityFactory2 > _factoryPerType = new Dictionary < Type , IEntityFactory2 > ( ) ;
/// <summary>Initializes the <see cref="EntityFactoryFactory"/> class.</summary>
static EntityFactoryFactory ( )
{
foreach ( int entityTypeValue in Enum . GetValues ( typeof ( Datalib . EntityType ) ) )
{
var factory = GetFactory ( ( Datalib . EntityType ) entityTypeValue ) ;
_factoryPerType . Add ( factory . ForEntityType ? ? factory . Create ( ) . GetType ( ) , factory ) ;
}
}
/// <summary>Gets the factory of the entity with the .NET type specified</summary>
/// <param name="typeOfEntity">The type of entity.</param>
/// <returns>factory to use or null if not found</returns>
public static IEntityFactory2 GetFactory ( Type typeOfEntity ) { return _factoryPerType . GetValue ( typeOfEntity ) ; }
/// <summary>Gets the factory of the entity with the Datalib.EntityType specified</summary>
/// <param name="typeOfEntity">The type of entity.</param>
/// <returns>factory to use or null if not found</returns>
public static IEntityFactory2 GetFactory ( Datalib . EntityType typeOfEntity )
{
switch ( typeOfEntity )
{
case Datalib . EntityType . TblFieldEntity :
return new TblFieldEntityFactory ( ) ;
case Datalib . EntityType . TblQuestionEntity :
return new TblQuestionEntityFactory ( ) ;
case Datalib . EntityType . TblQuizEntity :
return new TblQuizEntityFactory ( ) ;
case Datalib . EntityType . TblQuizQuestionEntity :
return new TblQuizQuestionEntityFactory ( ) ;
case Datalib . EntityType . TblQuizTemplateEntity :
return new TblQuizTemplateEntityFactory ( ) ;
case Datalib . EntityType . TblQuizTemplateDetailEntity :
return new TblQuizTemplateDetailEntityFactory ( ) ;
case Datalib . EntityType . TblSubjectEntity :
return new TblSubjectEntityFactory ( ) ;
case Datalib . EntityType . TblTrainingTypeEntity :
return new TblTrainingTypeEntityFactory ( ) ;
default :
return null ;
}
}
}
/// <summary>Element creator for creating project elements from somewhere else, like inside Linq providers.</summary>
public class ElementCreator : ElementCreatorBase , IElementCreator2
{
/// <summary>Gets the factory of the Entity type with the Datalib.EntityType value passed in</summary>
/// <param name="entityTypeValue">The entity type value.</param>
/// <returns>the entity factory of the entity type or null if not found</returns>
public IEntityFactory2 GetFactory ( int entityTypeValue ) { return ( IEntityFactory2 ) this . GetFactoryImpl ( entityTypeValue ) ; }
/// <summary>Gets the factory of the Entity type with the .NET type passed in</summary>
/// <param name="typeOfEntity">The type of entity.</param>
/// <returns>the entity factory of the entity type or null if not found</returns>
public IEntityFactory2 GetFactory ( Type typeOfEntity ) { return ( IEntityFactory2 ) this . GetFactoryImpl ( typeOfEntity ) ; }
/// <summary>Creates a new resultset fields object with the number of field slots reserved as specified</summary>
/// <param name="numberOfFields">The number of fields.</param>
/// <returns>ready to use resultsetfields object</returns>
public IEntityFields2 CreateResultsetFields ( int numberOfFields ) { return new ResultsetFields ( numberOfFields ) ; }
/// <inheritdoc/>
public override IInheritanceInfoProvider ObtainInheritanceInfoProviderInstance ( ) { return ModelInfoProviderSingleton . GetInstance ( ) ; }
/// <inheritdoc/>
public override IDynamicRelation CreateDynamicRelation ( DerivedTableDefinition leftOperand ) { return new DynamicRelation ( leftOperand ) ; }
/// <inheritdoc/>
public override IDynamicRelation CreateDynamicRelation ( DerivedTableDefinition leftOperand , JoinHint joinType , DerivedTableDefinition rightOperand , IPredicate onClause )
{
return new DynamicRelation ( leftOperand , joinType , rightOperand , onClause ) ;
}
/// <inheritdoc/>
public override IDynamicRelation CreateDynamicRelation ( IEntityFieldCore leftOperand , JoinHint joinType , DerivedTableDefinition rightOperand , string aliasLeftOperand , IPredicate onClause )
{
return new DynamicRelation ( leftOperand , joinType , rightOperand , aliasLeftOperand , onClause ) ;
}
/// <inheritdoc/>
public override IDynamicRelation CreateDynamicRelation ( DerivedTableDefinition leftOperand , JoinHint joinType , string rightOperandEntityName , string aliasRightOperand , IPredicate onClause )
{
return new DynamicRelation ( leftOperand , joinType , ( Datalib . EntityType ) Enum . Parse ( typeof ( Datalib . EntityType ) , rightOperandEntityName , false ) , aliasRightOperand , onClause ) ;
}
/// <inheritdoc/>
public override IDynamicRelation CreateDynamicRelation ( string leftOperandEntityName , JoinHint joinType , string rightOperandEntityName , string aliasLeftOperand , string aliasRightOperand , IPredicate onClause )
{
return new DynamicRelation ( ( Datalib . EntityType ) Enum . Parse ( typeof ( Datalib . EntityType ) , leftOperandEntityName , false ) , joinType , ( Datalib . EntityType ) Enum . Parse ( typeof ( Datalib . EntityType ) , rightOperandEntityName , false ) , aliasLeftOperand , aliasRightOperand , onClause ) ;
}
/// <inheritdoc/>
public override IDynamicRelation CreateDynamicRelation ( IEntityFieldCore leftOperand , JoinHint joinType , string rightOperandEntityName , string aliasLeftOperand , string aliasRightOperand , IPredicate onClause )
{
return new DynamicRelation ( leftOperand , joinType , ( Datalib . EntityType ) Enum . Parse ( typeof ( Datalib . EntityType ) , rightOperandEntityName , false ) , aliasLeftOperand , aliasRightOperand , onClause ) ;
}
/// <inheritdoc/>
protected override IEntityFactoryCore GetFactoryImpl ( int entityTypeValue ) { return EntityFactoryFactory . GetFactory ( ( Datalib . EntityType ) entityTypeValue ) ; }
/// <inheritdoc/>
protected override IEntityFactoryCore GetFactoryImpl ( Type typeOfEntity ) { return EntityFactoryFactory . GetFactory ( typeOfEntity ) ; }
}
}