//////////////////////////////////////////////////////////////
// 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.ComponentModel;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Datalib.HelperClasses;
using Datalib.FactoryClasses;
using Datalib.RelationClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace Datalib.EntityClasses
{
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
// __LLBLGENPRO_USER_CODE_REGION_END
/// Entity class which represents the entity 'TblQuestion'.
[Serializable]
public partial class TblQuestionEntity : CommonEntityBase
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
// __LLBLGENPRO_USER_CODE_REGION_END
{
private EntityCollection _tblQuizQuestions;
private TblSubjectEntity _tblSubject;
// __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers
// __LLBLGENPRO_USER_CODE_REGION_END
private static TblQuestionEntityStaticMetaData _staticMetaData = new TblQuestionEntityStaticMetaData();
private static TblQuestionRelations _relationsFactory = new TblQuestionRelations();
/// All names of fields mapped onto a relation. Usable for in-memory filtering
public static partial class MemberNames
{
/// Member name TblSubject
public static readonly string TblSubject = "TblSubject";
/// Member name TblQuizQuestions
public static readonly string TblQuizQuestions = "TblQuizQuestions";
}
/// Static meta-data storage for navigator related information
protected class TblQuestionEntityStaticMetaData : EntityStaticMetaDataBase
{
public TblQuestionEntityStaticMetaData()
{
SetEntityCoreInfo("TblQuestionEntity", InheritanceHierarchyType.None, false, (int)Datalib.EntityType.TblQuestionEntity, typeof(TblQuestionEntity), typeof(TblQuestionEntityFactory), false);
AddNavigatorMetaData>("TblQuizQuestions", a => a._tblQuizQuestions, (a, b) => a._tblQuizQuestions = b, a => a.TblQuizQuestions, () => new TblQuestionRelations().TblQuizQuestionEntityUsingQuestionId, typeof(TblQuizQuestionEntity), (int)Datalib.EntityType.TblQuizQuestionEntity);
AddNavigatorMetaData("TblSubject", "TblQuestions", (a, b) => a._tblSubject = b, a => a._tblSubject, (a, b) => a.TblSubject = b, Datalib.RelationClasses.StaticTblQuestionRelations.TblSubjectEntityUsingSubjectIdStatic, ()=>new TblQuestionRelations().TblSubjectEntityUsingSubjectId, null, new int[] { (int)TblQuestionFieldIndex.SubjectId }, null, true, (int)Datalib.EntityType.TblSubjectEntity);
}
}
/// Static ctor
static TblQuestionEntity()
{
}
/// CTor
public TblQuestionEntity()
{
InitClassEmpty(null, null);
}
/// CTor
/// Fields object to set as the fields for this entity.
public TblQuestionEntity(IEntityFields2 fields)
{
InitClassEmpty(null, fields);
}
/// CTor
/// The custom validator object for this TblQuestionEntity
public TblQuestionEntity(IValidator validator)
{
InitClassEmpty(validator, null);
}
/// CTor
/// PK value for TblQuestion which data should be fetched into this TblQuestion object
public TblQuestionEntity(System.String questionId) : this(questionId, null)
{
}
/// CTor
/// PK value for TblQuestion which data should be fetched into this TblQuestion object
/// The custom validator object for this TblQuestionEntity
public TblQuestionEntity(System.String questionId, IValidator validator)
{
InitClassEmpty(validator, null);
this.QuestionId = questionId;
}
/// Private CTor for deserialization
///
///
protected TblQuestionEntity(SerializationInfo info, StreamingContext context) : base(info, context)
{
// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
// __LLBLGENPRO_USER_CODE_REGION_END
}
/// Creates a new IRelationPredicateBucket object which contains the predicate expression and relation collection to fetch the related entities of type 'TblQuizQuestion' to this entity.
///
public virtual IRelationPredicateBucket GetRelationInfoTblQuizQuestions() { return CreateRelationInfoForNavigator("TblQuizQuestions"); }
/// Creates a new IRelationPredicateBucket object which contains the predicate expression and relation collection to fetch the related entity of type 'TblSubject' to this entity.
///
public virtual IRelationPredicateBucket GetRelationInfoTblSubject() { return CreateRelationInfoForNavigator("TblSubject"); }
///
protected override EntityStaticMetaDataBase GetEntityStaticMetaData() { return _staticMetaData; }
/// Initializes the class members
private void InitClassMembers()
{
PerformDependencyInjection();
// __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
// __LLBLGENPRO_USER_CODE_REGION_END
OnInitClassMembersComplete();
}
/// Initializes the class with empty data, as if it is a new Entity.
/// The validator object for this TblQuestionEntity
/// Fields of this entity
private void InitClassEmpty(IValidator validator, IEntityFields2 fields)
{
OnInitializing();
this.Fields = fields ?? CreateFields();
this.Validator = validator;
InitClassMembers();
// __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
// __LLBLGENPRO_USER_CODE_REGION_END
OnInitialized();
}
/// The relations object holding all relations of this entity with other entity classes.
public static TblQuestionRelations Relations { get { return _relationsFactory; } }
/// Creates a new PrefetchPathElement2 object which contains all the information to prefetch the related entities of type 'TblQuizQuestion' for this entity.
/// Ready to use IPrefetchPathElement2 implementation.
public static IPrefetchPathElement2 PrefetchPathTblQuizQuestions { get { return _staticMetaData.GetPrefetchPathElement("TblQuizQuestions", CommonEntityBase.CreateEntityCollection()); } }
/// Creates a new PrefetchPathElement2 object which contains all the information to prefetch the related entities of type 'TblSubject' for this entity.
/// Ready to use IPrefetchPathElement2 implementation.
public static IPrefetchPathElement2 PrefetchPathTblSubject { get { return _staticMetaData.GetPrefetchPathElement("TblSubject", CommonEntityBase.CreateEntityCollection()); } }
/// The Answer property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Answer".
Table field type characteristics (type, precision, scale, length): LongVarWChar, 0, 0, 536870911.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String Answer
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.Answer, true); }
set { SetValue((int)TblQuestionFieldIndex.Answer, value); }
}
/// The Content property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Content".
Table field type characteristics (type, precision, scale, length): LongVarWChar, 0, 0, 536870911.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String Content
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.Content, true); }
set { SetValue((int)TblQuestionFieldIndex.Content, value); }
}
/// The CreateDate property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."CreateDate".
Table field type characteristics (type, precision, scale, length): Date, 0, 0, 0.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual Nullable CreateDate
{
get { return (Nullable)GetValue((int)TblQuestionFieldIndex.CreateDate, false); }
set { SetValue((int)TblQuestionFieldIndex.CreateDate, value); }
}
/// The Difficulty property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Difficulty".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 1.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String Difficulty
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.Difficulty, true); }
set { SetValue((int)TblQuestionFieldIndex.Difficulty, value); }
}
/// The Exclusive property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Exclusive".
Table field type characteristics (type, precision, scale, length): Boolean, 0, 0, 2.
Table field behavior characteristics (is nullable, is PK, is identity): false, false, false
public virtual System.Boolean Exclusive
{
get { return (System.Boolean)GetValue((int)TblQuestionFieldIndex.Exclusive, true); }
set { SetValue((int)TblQuestionFieldIndex.Exclusive, value); }
}
/// The Explaination property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Explaination".
Table field type characteristics (type, precision, scale, length): LongVarWChar, 0, 0, 536870911.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String Explaination
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.Explaination, true); }
set { SetValue((int)TblQuestionFieldIndex.Explaination, value); }
}
/// The FieldId property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."FieldID".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 1.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String FieldId
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.FieldId, true); }
set { SetValue((int)TblQuestionFieldIndex.FieldId, value); }
}
/// The Level property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Level".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 1.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String Level
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.Level, true); }
set { SetValue((int)TblQuestionFieldIndex.Level, value); }
}
/// The QuestionCode property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."QuestionCode".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 10.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String QuestionCode
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.QuestionCode, true); }
set { SetValue((int)TblQuestionFieldIndex.QuestionCode, value); }
}
/// The QuestionId property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."QuestionID".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 32.
Table field behavior characteristics (is nullable, is PK, is identity): false, true, false
public virtual System.String QuestionId
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.QuestionId, true); }
set { SetValue((int)TblQuestionFieldIndex.QuestionId, value); }
}
/// The SubjectId property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."SubjectID".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 2.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String SubjectId
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.SubjectId, true); }
set { SetValue((int)TblQuestionFieldIndex.SubjectId, value); }
}
/// The Summary property of the Entity TblQuestion
/// Mapped on table field: "tblQuestions"."Summary".
Table field type characteristics (type, precision, scale, length): LongVarWChar, 0, 0, 536870911.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String Summary
{
get { return (System.String)GetValue((int)TblQuestionFieldIndex.Summary, true); }
set { SetValue((int)TblQuestionFieldIndex.Summary, value); }
}
/// Gets the EntityCollection with the related entities of type 'TblQuizQuestionEntity' which are related to this entity via a relation of type '1:n'. If the EntityCollection hasn't been fetched yet, the collection returned will be empty.
[TypeContainedAttribute(typeof(TblQuizQuestionEntity))]
public virtual EntityCollection TblQuizQuestions { get { return GetOrCreateEntityCollection("TblQuestion", true, false, ref _tblQuizQuestions); } }
/// Gets / sets related entity of type 'TblSubjectEntity' which has to be set using a fetch action earlier. If no related entity is set for this property, null is returned..
[Browsable(false)]
public virtual TblSubjectEntity TblSubject
{
get { return _tblSubject; }
set { SetSingleRelatedEntityNavigator(value, "TblSubject"); }
}
// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
// __LLBLGENPRO_USER_CODE_REGION_END
}
}
namespace Datalib
{
public enum TblQuestionFieldIndex
{
///Answer.
Answer,
///Content.
Content,
///CreateDate.
CreateDate,
///Difficulty.
Difficulty,
///Exclusive.
Exclusive,
///Explaination.
Explaination,
///FieldId.
FieldId,
///Level.
Level,
///QuestionCode.
QuestionCode,
///QuestionId.
QuestionId,
///SubjectId.
SubjectId,
///Summary.
Summary,
///
AmountOfFields
}
}
namespace Datalib.RelationClasses
{
/// Implements the relations factory for the entity: TblQuestion.
public partial class TblQuestionRelations: RelationFactory
{
/// Returns a new IEntityRelation object, between TblQuestionEntity and TblQuizQuestionEntity over the 1:n relation they have, using the relation between the fields: TblQuestion.QuestionId - TblQuizQuestion.QuestionId
public virtual IEntityRelation TblQuizQuestionEntityUsingQuestionId
{
get { return ModelInfoProviderSingleton.GetInstance().CreateRelation(RelationType.OneToMany, "TblQuizQuestions", true, new[] { TblQuestionFields.QuestionId, TblQuizQuestionFields.QuestionId }); }
}
/// Returns a new IEntityRelation object, between TblQuestionEntity and TblSubjectEntity over the m:1 relation they have, using the relation between the fields: TblQuestion.SubjectId - TblSubject.SubjectId
public virtual IEntityRelation TblSubjectEntityUsingSubjectId
{
get { return ModelInfoProviderSingleton.GetInstance().CreateRelation(RelationType.ManyToOne, "TblSubject", false, new[] { TblSubjectFields.SubjectId, TblQuestionFields.SubjectId }); }
}
}
/// Static class which is used for providing relationship instances which are re-used internally for syncing
internal static class StaticTblQuestionRelations
{
internal static readonly IEntityRelation TblQuizQuestionEntityUsingQuestionIdStatic = new TblQuestionRelations().TblQuizQuestionEntityUsingQuestionId;
internal static readonly IEntityRelation TblSubjectEntityUsingSubjectIdStatic = new TblQuestionRelations().TblSubjectEntityUsingSubjectId;
/// CTor
static StaticTblQuestionRelations() { }
}
}