//////////////////////////////////////////////////////////////
// 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 'TblSubject'.
[Serializable]
public partial class TblSubjectEntity : CommonEntityBase
// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
// __LLBLGENPRO_USER_CODE_REGION_END
{
private EntityCollection _tblFields;
private EntityCollection _tblQuestions;
// __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers
// __LLBLGENPRO_USER_CODE_REGION_END
private static TblSubjectEntityStaticMetaData _staticMetaData = new TblSubjectEntityStaticMetaData();
private static TblSubjectRelations _relationsFactory = new TblSubjectRelations();
/// All names of fields mapped onto a relation. Usable for in-memory filtering
public static partial class MemberNames
{
/// Member name TblFields
public static readonly string TblFields = "TblFields";
/// Member name TblQuestions
public static readonly string TblQuestions = "TblQuestions";
}
/// Static meta-data storage for navigator related information
protected class TblSubjectEntityStaticMetaData : EntityStaticMetaDataBase
{
public TblSubjectEntityStaticMetaData()
{
SetEntityCoreInfo("TblSubjectEntity", InheritanceHierarchyType.None, false, (int)Datalib.EntityType.TblSubjectEntity, typeof(TblSubjectEntity), typeof(TblSubjectEntityFactory), false);
AddNavigatorMetaData>("TblFields", a => a._tblFields, (a, b) => a._tblFields = b, a => a.TblFields, () => new TblSubjectRelations().TblFieldEntityUsingSubjectId, typeof(TblFieldEntity), (int)Datalib.EntityType.TblFieldEntity);
AddNavigatorMetaData>("TblQuestions", a => a._tblQuestions, (a, b) => a._tblQuestions = b, a => a.TblQuestions, () => new TblSubjectRelations().TblQuestionEntityUsingSubjectId, typeof(TblQuestionEntity), (int)Datalib.EntityType.TblQuestionEntity);
}
}
/// Static ctor
static TblSubjectEntity()
{
}
/// CTor
public TblSubjectEntity()
{
InitClassEmpty(null, null);
}
/// CTor
/// Fields object to set as the fields for this entity.
public TblSubjectEntity(IEntityFields2 fields)
{
InitClassEmpty(null, fields);
}
/// CTor
/// The custom validator object for this TblSubjectEntity
public TblSubjectEntity(IValidator validator)
{
InitClassEmpty(validator, null);
}
/// CTor
/// PK value for TblSubject which data should be fetched into this TblSubject object
public TblSubjectEntity(System.String subjectId) : this(subjectId, null)
{
}
/// CTor
/// PK value for TblSubject which data should be fetched into this TblSubject object
/// The custom validator object for this TblSubjectEntity
public TblSubjectEntity(System.String subjectId, IValidator validator)
{
InitClassEmpty(validator, null);
this.SubjectId = subjectId;
}
/// Private CTor for deserialization
///
///
protected TblSubjectEntity(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 'TblField' to this entity.
///
public virtual IRelationPredicateBucket GetRelationInfoTblFields() { return CreateRelationInfoForNavigator("TblFields"); }
/// Creates a new IRelationPredicateBucket object which contains the predicate expression and relation collection to fetch the related entities of type 'TblQuestion' to this entity.
///
public virtual IRelationPredicateBucket GetRelationInfoTblQuestions() { return CreateRelationInfoForNavigator("TblQuestions"); }
///
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 TblSubjectEntity
/// 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 TblSubjectRelations Relations { get { return _relationsFactory; } }
/// Creates a new PrefetchPathElement2 object which contains all the information to prefetch the related entities of type 'TblField' for this entity.
/// Ready to use IPrefetchPathElement2 implementation.
public static IPrefetchPathElement2 PrefetchPathTblFields { get { return _staticMetaData.GetPrefetchPathElement("TblFields", CommonEntityBase.CreateEntityCollection()); } }
/// Creates a new PrefetchPathElement2 object which contains all the information to prefetch the related entities of type 'TblQuestion' for this entity.
/// Ready to use IPrefetchPathElement2 implementation.
public static IPrefetchPathElement2 PrefetchPathTblQuestions { get { return _staticMetaData.GetPrefetchPathElement("TblQuestions", CommonEntityBase.CreateEntityCollection()); } }
/// The SubjectDes property of the Entity TblSubject
/// Mapped on table field: "tblSubjects"."SubjectDes".
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 SubjectDes
{
get { return (System.String)GetValue((int)TblSubjectFieldIndex.SubjectDes, true); }
set { SetValue((int)TblSubjectFieldIndex.SubjectDes, value); }
}
/// The SubjectId property of the Entity TblSubject
/// Mapped on table field: "tblSubjects"."SubjectID".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 2.
Table field behavior characteristics (is nullable, is PK, is identity): false, true, false
public virtual System.String SubjectId
{
get { return (System.String)GetValue((int)TblSubjectFieldIndex.SubjectId, true); }
set { SetValue((int)TblSubjectFieldIndex.SubjectId, value); }
}
/// The SubjectName property of the Entity TblSubject
/// Mapped on table field: "tblSubjects"."SubjectName".
Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 50.
Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String SubjectName
{
get { return (System.String)GetValue((int)TblSubjectFieldIndex.SubjectName, true); }
set { SetValue((int)TblSubjectFieldIndex.SubjectName, value); }
}
/// Gets the EntityCollection with the related entities of type 'TblFieldEntity' 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(TblFieldEntity))]
public virtual EntityCollection TblFields { get { return GetOrCreateEntityCollection("TblSubject", true, false, ref _tblFields); } }
/// Gets the EntityCollection with the related entities of type 'TblQuestionEntity' 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(TblQuestionEntity))]
public virtual EntityCollection TblQuestions { get { return GetOrCreateEntityCollection("TblSubject", true, false, ref _tblQuestions); } }
// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
// __LLBLGENPRO_USER_CODE_REGION_END
}
}
namespace Datalib
{
public enum TblSubjectFieldIndex
{
///SubjectDes.
SubjectDes,
///SubjectId.
SubjectId,
///SubjectName.
SubjectName,
///
AmountOfFields
}
}
namespace Datalib.RelationClasses
{
/// Implements the relations factory for the entity: TblSubject.
public partial class TblSubjectRelations: RelationFactory
{
/// Returns a new IEntityRelation object, between TblSubjectEntity and TblFieldEntity over the 1:n relation they have, using the relation between the fields: TblSubject.SubjectId - TblField.SubjectId
public virtual IEntityRelation TblFieldEntityUsingSubjectId
{
get { return ModelInfoProviderSingleton.GetInstance().CreateRelation(RelationType.OneToMany, "TblFields", true, new[] { TblSubjectFields.SubjectId, TblFieldFields.SubjectId }); }
}
/// Returns a new IEntityRelation object, between TblSubjectEntity and TblQuestionEntity over the 1:n relation they have, using the relation between the fields: TblSubject.SubjectId - TblQuestion.SubjectId
public virtual IEntityRelation TblQuestionEntityUsingSubjectId
{
get { return ModelInfoProviderSingleton.GetInstance().CreateRelation(RelationType.OneToMany, "TblQuestions", true, new[] { TblSubjectFields.SubjectId, TblQuestionFields.SubjectId }); }
}
}
/// Static class which is used for providing relationship instances which are re-used internally for syncing
internal static class StaticTblSubjectRelations
{
internal static readonly IEntityRelation TblFieldEntityUsingSubjectIdStatic = new TblSubjectRelations().TblFieldEntityUsingSubjectId;
internal static readonly IEntityRelation TblQuestionEntityUsingSubjectIdStatic = new TblSubjectRelations().TblQuestionEntityUsingSubjectId;
/// CTor
static StaticTblSubjectRelations() { }
}
}