////////////////////////////////////////////////////////////// // This code was generated by LLBLGen Pro 5.7. ////////////////////////////////////////////////////////////// // Code is generated on: // Code is generated using templates: SD.TemplateBindings.SharedTemplates // Templates vendor: Solutions Design. ////////////////////////////////////////////////////////////// using System; using System.Linq; using System.Collections.Generic; using SD.LLBLGen.Pro.LinqSupportClasses; using SD.LLBLGen.Pro.ORMSupportClasses; using Datalib.EntityClasses; using Datalib.FactoryClasses; namespace Datalib.Linq { /// Meta-data class for the construction of Linq queries which are to be executed using LLBLGen Pro code. public partial class LinqMetaData: ILinqMetaData { /// CTor. Using this ctor will leave the IDataAccessAdapter object to use empty. To be able to execute the query, an IDataAccessAdapter instance /// is required, and has to be set on the LLBLGenProProvider2 object in the query to execute. public LinqMetaData() : this(null, null) { } /// CTor which accepts an IDataAccessAdapter implementing object, which will be used to execute queries created with this metadata class. /// the IDataAccessAdapter to use in queries created with this meta data /// Be aware that the IDataAccessAdapter object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data till they go out of scope. public LinqMetaData(IDataAccessAdapter adapterToUse) : this (adapterToUse, null) { } /// CTor which accepts an IDataAccessAdapter implementing object, which will be used to execute queries created with this metadata class. /// the IDataAccessAdapter to use in queries created with this meta data /// The custom function mappings to use. These take higher precedence than the ones in the DQE to use. /// Be aware that the IDataAccessAdapter object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data till they go out of scope. public LinqMetaData(IDataAccessAdapter adapterToUse, FunctionMappingStore customFunctionMappings) { this.AdapterToUse = adapterToUse; this.CustomFunctionMappings = customFunctionMappings; } /// returns the datasource to use in a Linq query for the entity type specified /// the type of the entity to get the datasource for /// the requested datasource public IDataSource GetQueryableForEntity(int typeOfEntity) { switch((Datalib.EntityType)typeOfEntity) { case Datalib.EntityType.TblFieldEntity: return this.TblField; case Datalib.EntityType.TblQuestionEntity: return this.TblQuestion; case Datalib.EntityType.TblQuizEntity: return this.TblQuiz; case Datalib.EntityType.TblQuizQuestionEntity: return this.TblQuizQuestion; case Datalib.EntityType.TblQuizTemplateEntity: return this.TblQuizTemplate; case Datalib.EntityType.TblQuizTemplateDetailEntity: return this.TblQuizTemplateDetail; case Datalib.EntityType.TblSubjectEntity: return this.TblSubject; case Datalib.EntityType.TblTrainingTypeEntity: return this.TblTrainingType; default: return null; } } /// returns the datasource to use in a Linq query for the entity type specified /// the type of the entity to get the datasource for /// the requested datasource public DataSource2 GetQueryableForEntity() where TEntity : class { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } /// returns the datasource to use in a Linq query when targeting TblFieldEntity instances in the database. public DataSource2 TblField { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblQuestionEntity instances in the database. public DataSource2 TblQuestion { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblQuizEntity instances in the database. public DataSource2 TblQuiz { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblQuizQuestionEntity instances in the database. public DataSource2 TblQuizQuestion { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblQuizTemplateEntity instances in the database. public DataSource2 TblQuizTemplate { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblQuizTemplateDetailEntity instances in the database. public DataSource2 TblQuizTemplateDetail { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblSubjectEntity instances in the database. public DataSource2 TblSubject { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// returns the datasource to use in a Linq query when targeting TblTrainingTypeEntity instances in the database. public DataSource2 TblTrainingType { get { return new DataSource2(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } } /// Gets / sets the IDataAccessAdapter to use for the queries created with this meta data object. /// Be aware that the IDataAccessAdapter object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data /// till they go out of scope. public IDataAccessAdapter AdapterToUse { get; set; } /// Gets or sets the custom function mappings to use. These take higher precedence than the ones in the DQE to use public FunctionMappingStore CustomFunctionMappings { get; set; } /// Gets or sets the Context instance to use for entity fetches. public Context ContextToUse { get; set; } } }