Files
csharpcode/omegapro/Datalib/DatabaseGeneric/HelperClasses/LinqMetaData.cs
2025-08-02 05:20:17 +07:00

114 lines
7.2 KiB
C#

//////////////////////////////////////////////////////////////
// <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.Linq;
using System.Collections.Generic;
using SD.LLBLGen.Pro.LinqSupportClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
using Datalib.EntityClasses;
using Datalib.FactoryClasses;
namespace Datalib.Linq
{
/// <summary>Meta-data class for the construction of Linq queries which are to be executed using LLBLGen Pro code.</summary>
public partial class LinqMetaData: ILinqMetaData
{
/// <summary>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. </summary>
public LinqMetaData() : this(null, null) { }
/// <summary>CTor which accepts an IDataAccessAdapter implementing object, which will be used to execute queries created with this metadata class.</summary>
/// <param name="adapterToUse">the IDataAccessAdapter to use in queries created with this meta data</param>
/// <remarks> 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.</remarks>
public LinqMetaData(IDataAccessAdapter adapterToUse) : this (adapterToUse, null) { }
/// <summary>CTor which accepts an IDataAccessAdapter implementing object, which will be used to execute queries created with this metadata class.</summary>
/// <param name="adapterToUse">the IDataAccessAdapter to use in queries created with this meta data</param>
/// <param name="customFunctionMappings">The custom function mappings to use. These take higher precedence than the ones in the DQE to use.</param>
/// <remarks> 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.</remarks>
public LinqMetaData(IDataAccessAdapter adapterToUse, FunctionMappingStore customFunctionMappings)
{
this.AdapterToUse = adapterToUse;
this.CustomFunctionMappings = customFunctionMappings;
}
/// <summary>returns the datasource to use in a Linq query for the entity type specified</summary>
/// <param name="typeOfEntity">the type of the entity to get the datasource for</param>
/// <returns>the requested datasource</returns>
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;
}
}
/// <summary>returns the datasource to use in a Linq query for the entity type specified</summary>
/// <typeparam name="TEntity">the type of the entity to get the datasource for</typeparam>
/// <returns>the requested datasource</returns>
public DataSource2<TEntity> GetQueryableForEntity<TEntity>()
where TEntity : class
{
return new DataSource2<TEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse);
}
/// <summary>returns the datasource to use in a Linq query when targeting TblFieldEntity instances in the database.</summary>
public DataSource2<TblFieldEntity> TblField { get { return new DataSource2<TblFieldEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblQuestionEntity instances in the database.</summary>
public DataSource2<TblQuestionEntity> TblQuestion { get { return new DataSource2<TblQuestionEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblQuizEntity instances in the database.</summary>
public DataSource2<TblQuizEntity> TblQuiz { get { return new DataSource2<TblQuizEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblQuizQuestionEntity instances in the database.</summary>
public DataSource2<TblQuizQuestionEntity> TblQuizQuestion { get { return new DataSource2<TblQuizQuestionEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblQuizTemplateEntity instances in the database.</summary>
public DataSource2<TblQuizTemplateEntity> TblQuizTemplate { get { return new DataSource2<TblQuizTemplateEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblQuizTemplateDetailEntity instances in the database.</summary>
public DataSource2<TblQuizTemplateDetailEntity> TblQuizTemplateDetail { get { return new DataSource2<TblQuizTemplateDetailEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblSubjectEntity instances in the database.</summary>
public DataSource2<TblSubjectEntity> TblSubject { get { return new DataSource2<TblSubjectEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary>returns the datasource to use in a Linq query when targeting TblTrainingTypeEntity instances in the database.</summary>
public DataSource2<TblTrainingTypeEntity> TblTrainingType { get { return new DataSource2<TblTrainingTypeEntity>(this.AdapterToUse, new ElementCreator(), this.CustomFunctionMappings, this.ContextToUse); } }
/// <summary> Gets / sets the IDataAccessAdapter to use for the queries created with this meta data object.</summary>
/// <remarks> 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.</remarks>
public IDataAccessAdapter AdapterToUse { get; set; }
/// <summary>Gets or sets the custom function mappings to use. These take higher precedence than the ones in the DQE to use</summary>
public FunctionMappingStore CustomFunctionMappings { get; set; }
/// <summary>Gets or sets the Context instance to use for entity fetches.</summary>
public Context ContextToUse { get; set; }
}
}