Files
2025-08-02 05:20:17 +07:00

812 lines
40 KiB
C#

///////////////////////////////////////////////////////////////
// This is generated code.
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 4.2
// Code is generated on:
// Code is generated using templates: SD.TemplateBindings.SharedTemplates
// Templates vendor: Solutions Design.
// Templates version:
//////////////////////////////////////////////////////////////
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;
}
/// <summary>Creates, using the generated EntityFieldsFactory, the IEntityFields2 object for the entity to create.</summary>
/// <returns>Empty IEntityFields2 object.</returns>
public override IEntityFields2 CreateFields()
{
return EntityFieldsFactory.CreateEntityFieldsObject(_typeOfEntity);
}
/// <summary>Creates a new entity instance using the GeneralEntityFactory in the generated code, using the passed in entitytype value</summary>
/// <param name="entityTypeValue">The entity type value of the entity to create an instance for.</param>
/// <returns>new IEntity instance</returns>
public override IEntity2 CreateEntityFromEntityTypeValue(int entityTypeValue)
{
return GeneralEntityFactory.Create((Datalib.EntityType)entityTypeValue);
}
/// <summary>Creates the relations collection to the entity to join all targets so this entity can be fetched. </summary>
/// <param name="objectAlias">The object alias to use for the elements in the relations.</param>
/// <returns>null if the entity isn't in a hierarchy of type TargetPerEntity, otherwise the relations collection needed to join all targets together to fetch all subtypes of this entity and this entity itself</returns>
public override IRelationCollection CreateHierarchyRelations(string objectAlias)
{
return InheritanceInfoProviderSingleton.GetInstance().GetHierarchyRelations(this.ForEntityName, objectAlias);
}
/// <summary>This method retrieves, using the InheritanceInfoprovider, the factory for the entity represented by the values passed in.</summary>
/// <param name="fieldValues">Field values read from the db, to determine which factory to return, based on the field values passed in.</param>
/// <param name="entityFieldStartIndexesPerEntity">indexes into values where per entity type their own fields start.</param>
/// <returns>the factory for the entity which is represented by the values passed in.</returns>
public override IEntityFactory2 GetEntityFactory(object[] fieldValues, Dictionary<string, int> entityFieldStartIndexesPerEntity)
{
IEntityFactory2 toReturn = (IEntityFactory2)InheritanceInfoProviderSingleton.GetInstance().GetEntityFactory(this.ForEntityName, fieldValues, entityFieldStartIndexesPerEntity);
if(toReturn == null)
{
toReturn = this;
}
return toReturn;
}
/// <summary>Gets a predicateexpression which filters on the entity with type belonging to this factory.</summary>
/// <param name="negate">Flag to produce a NOT filter, (true), or a normal filter (false). </param>
/// <param name="objectAlias">The object alias to use for the predicate(s).</param>
/// <returns>ready to use predicateexpression, or an empty predicate expression if the belonging entity isn't a hierarchical type.</returns>
public override IPredicateExpression GetEntityTypeFilter(bool negate, string objectAlias)
{
return InheritanceInfoProviderSingleton.GetInstance().GetEntityTypeFilter(this.ForEntityName, objectAlias, negate);
}
/// <summary>Creates a new generic EntityCollection(Of T) for the entity which this factory belongs to.</summary>
/// <returns>ready to use generic EntityCollection(Of T) with this factory set as the factory</returns>
public override IEntityCollection2 CreateEntityCollection()
{
return new EntityCollection<TEntity>(this);
}
/// <summary>Creates the hierarchy fields for the entity to which this factory belongs.</summary>
/// <returns>IEntityFields2 object with the fields of all the entities in teh hierarchy of this entity or the fields of this entity if the entity isn't in a hierarchy.</returns>
public override IEntityFields2 CreateHierarchyFields()
{
return _isInHierarchy ? new EntityFields2(InheritanceInfoProviderSingleton.GetInstance().GetHierarchyFields(this.ForEntityName), InheritanceInfoProviderSingleton.GetInstance(), null) : base.CreateHierarchyFields();
}
}
/// <summary>Factory to create new, empty TblAgeGroupEntity objects.</summary>
[Serializable]
public partial class TblAgeGroupEntityFactory : EntityFactoryBase2<TblAgeGroupEntity> {
/// <summary>CTor</summary>
public TblAgeGroupEntityFactory() : base("TblAgeGroupEntity", Datalib.EntityType.TblAgeGroupEntity, false) { }
/// <summary>Creates a new TblAgeGroupEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblAgeGroupEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblAgeGroupUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblAgencyEntity objects.</summary>
[Serializable]
public partial class TblAgencyEntityFactory : EntityFactoryBase2<TblAgencyEntity> {
/// <summary>CTor</summary>
public TblAgencyEntityFactory() : base("TblAgencyEntity", Datalib.EntityType.TblAgencyEntity, false) { }
/// <summary>Creates a new TblAgencyEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblAgencyEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblAgencyUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblChildEntity objects.</summary>
[Serializable]
public partial class TblChildEntityFactory : EntityFactoryBase2<TblChildEntity> {
/// <summary>CTor</summary>
public TblChildEntityFactory() : base("TblChildEntity", Datalib.EntityType.TblChildEntity, false) { }
/// <summary>Creates a new TblChildEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblChildEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblChildUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblClinicInfoEntity objects.</summary>
[Serializable]
public partial class TblClinicInfoEntityFactory : EntityFactoryBase2<TblClinicInfoEntity> {
/// <summary>CTor</summary>
public TblClinicInfoEntityFactory() : base("TblClinicInfoEntity", Datalib.EntityType.TblClinicInfoEntity, false) { }
/// <summary>Creates a new TblClinicInfoEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblClinicInfoEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblClinicInfoUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblCommuneEntity objects.</summary>
[Serializable]
public partial class TblCommuneEntityFactory : EntityFactoryBase2<TblCommuneEntity> {
/// <summary>CTor</summary>
public TblCommuneEntityFactory() : base("TblCommuneEntity", Datalib.EntityType.TblCommuneEntity, false) { }
/// <summary>Creates a new TblCommuneEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblCommuneEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblCommuneUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblDiaryEntity objects.</summary>
[Serializable]
public partial class TblDiaryEntityFactory : EntityFactoryBase2<TblDiaryEntity> {
/// <summary>CTor</summary>
public TblDiaryEntityFactory() : base("TblDiaryEntity", Datalib.EntityType.TblDiaryEntity, false) { }
/// <summary>Creates a new TblDiaryEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblDiaryEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblDiaryUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblDistrictEntity objects.</summary>
[Serializable]
public partial class TblDistrictEntityFactory : EntityFactoryBase2<TblDistrictEntity> {
/// <summary>CTor</summary>
public TblDistrictEntityFactory() : base("TblDistrictEntity", Datalib.EntityType.TblDistrictEntity, false) { }
/// <summary>Creates a new TblDistrictEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblDistrictEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblDistrictUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblExaminationInfoEntity objects.</summary>
[Serializable]
public partial class TblExaminationInfoEntityFactory : EntityFactoryBase2<TblExaminationInfoEntity> {
/// <summary>CTor</summary>
public TblExaminationInfoEntityFactory() : base("TblExaminationInfoEntity", Datalib.EntityType.TblExaminationInfoEntity, false) { }
/// <summary>Creates a new TblExaminationInfoEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblExaminationInfoEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblExaminationInfoUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblPatientEntity objects.</summary>
[Serializable]
public partial class TblPatientEntityFactory : EntityFactoryBase2<TblPatientEntity> {
/// <summary>CTor</summary>
public TblPatientEntityFactory() : base("TblPatientEntity", Datalib.EntityType.TblPatientEntity, false) { }
/// <summary>Creates a new TblPatientEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblPatientEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblPatientUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblPreClinicsInfoEntity objects.</summary>
[Serializable]
public partial class TblPreClinicsInfoEntityFactory : EntityFactoryBase2<TblPreClinicsInfoEntity> {
/// <summary>CTor</summary>
public TblPreClinicsInfoEntityFactory() : base("TblPreClinicsInfoEntity", Datalib.EntityType.TblPreClinicsInfoEntity, false) { }
/// <summary>Creates a new TblPreClinicsInfoEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblPreClinicsInfoEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblPreClinicsInfoUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblPregnanceInfoEntity objects.</summary>
[Serializable]
public partial class TblPregnanceInfoEntityFactory : EntityFactoryBase2<TblPregnanceInfoEntity> {
/// <summary>CTor</summary>
public TblPregnanceInfoEntityFactory() : base("TblPregnanceInfoEntity", Datalib.EntityType.TblPregnanceInfoEntity, false) { }
/// <summary>Creates a new TblPregnanceInfoEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblPregnanceInfoEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblPregnanceInfoUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblProvinceEntity objects.</summary>
[Serializable]
public partial class TblProvinceEntityFactory : EntityFactoryBase2<TblProvinceEntity> {
/// <summary>CTor</summary>
public TblProvinceEntityFactory() : base("TblProvinceEntity", Datalib.EntityType.TblProvinceEntity, false) { }
/// <summary>Creates a new TblProvinceEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblProvinceEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblProvinceUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblReferralFromPlaceEntity objects.</summary>
[Serializable]
public partial class TblReferralFromPlaceEntityFactory : EntityFactoryBase2<TblReferralFromPlaceEntity> {
/// <summary>CTor</summary>
public TblReferralFromPlaceEntityFactory() : base("TblReferralFromPlaceEntity", Datalib.EntityType.TblReferralFromPlaceEntity, false) { }
/// <summary>Creates a new TblReferralFromPlaceEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblReferralFromPlaceEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblReferralFromPlaceUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblReferralsToEntity objects.</summary>
[Serializable]
public partial class TblReferralsToEntityFactory : EntityFactoryBase2<TblReferralsToEntity> {
/// <summary>CTor</summary>
public TblReferralsToEntityFactory() : base("TblReferralsToEntity", Datalib.EntityType.TblReferralsToEntity, false) { }
/// <summary>Creates a new TblReferralsToEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblReferralsToEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblReferralsToUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblReferraltoServiceEntity objects.</summary>
[Serializable]
public partial class TblReferraltoServiceEntityFactory : EntityFactoryBase2<TblReferraltoServiceEntity> {
/// <summary>CTor</summary>
public TblReferraltoServiceEntityFactory() : base("TblReferraltoServiceEntity", Datalib.EntityType.TblReferraltoServiceEntity, false) { }
/// <summary>Creates a new TblReferraltoServiceEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblReferraltoServiceEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblReferraltoServiceUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblRegimenEntity objects.</summary>
[Serializable]
public partial class TblRegimenEntityFactory : EntityFactoryBase2<TblRegimenEntity> {
/// <summary>CTor</summary>
public TblRegimenEntityFactory() : base("TblRegimenEntity", Datalib.EntityType.TblRegimenEntity, false) { }
/// <summary>Creates a new TblRegimenEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblRegimenEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblRegimenUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblRegimenStopReasonEntity objects.</summary>
[Serializable]
public partial class TblRegimenStopReasonEntityFactory : EntityFactoryBase2<TblRegimenStopReasonEntity> {
/// <summary>CTor</summary>
public TblRegimenStopReasonEntityFactory() : base("TblRegimenStopReasonEntity", Datalib.EntityType.TblRegimenStopReasonEntity, false) { }
/// <summary>Creates a new TblRegimenStopReasonEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblRegimenStopReasonEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblRegimenStopReasonUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblServiceEntity objects.</summary>
[Serializable]
public partial class TblServiceEntityFactory : EntityFactoryBase2<TblServiceEntity> {
/// <summary>CTor</summary>
public TblServiceEntityFactory() : base("TblServiceEntity", Datalib.EntityType.TblServiceEntity, false) { }
/// <summary>Creates a new TblServiceEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblServiceEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblServiceUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblTestEntity objects.</summary>
[Serializable]
public partial class TblTestEntityFactory : EntityFactoryBase2<TblTestEntity> {
/// <summary>CTor</summary>
public TblTestEntityFactory() : base("TblTestEntity", Datalib.EntityType.TblTestEntity, false) { }
/// <summary>Creates a new TblTestEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblTestEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblTestUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblTreatmentEntity objects.</summary>
[Serializable]
public partial class TblTreatmentEntityFactory : EntityFactoryBase2<TblTreatmentEntity> {
/// <summary>CTor</summary>
public TblTreatmentEntityFactory() : base("TblTreatmentEntity", Datalib.EntityType.TblTreatmentEntity, false) { }
/// <summary>Creates a new TblTreatmentEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblTreatmentEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblTreatmentUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblTreatmentInfoEntity objects.</summary>
[Serializable]
public partial class TblTreatmentInfoEntityFactory : EntityFactoryBase2<TblTreatmentInfoEntity> {
/// <summary>CTor</summary>
public TblTreatmentInfoEntityFactory() : base("TblTreatmentInfoEntity", Datalib.EntityType.TblTreatmentInfoEntity, false) { }
/// <summary>Creates a new TblTreatmentInfoEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblTreatmentInfoEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblTreatmentInfoUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <summary>Factory to create new, empty TblWaitingListEntity objects.</summary>
[Serializable]
public partial class TblWaitingListEntityFactory : EntityFactoryBase2<TblWaitingListEntity> {
/// <summary>CTor</summary>
public TblWaitingListEntityFactory() : base("TblWaitingListEntity", Datalib.EntityType.TblWaitingListEntity, false) { }
/// <summary>Creates a new TblWaitingListEntity instance but uses a special constructor which will set the Fields object of the new IEntity2 instance to the passed in fields object.</summary>
/// <param name="fields">Populated IEntityFields2 object for the new IEntity2 to create</param>
/// <returns>Fully created and populated (due to the IEntityFields2 object) IEntity2 object</returns>
public override IEntity2 Create(IEntityFields2 fields) {
IEntity2 toReturn = new TblWaitingListEntity(fields);
// __LLBLGENPRO_USER_CODE_REGION_START CreateNewTblWaitingListUsingFields
// __LLBLGENPRO_USER_CODE_REGION_END
return toReturn;
}
#region Included Code
#endregion
}
/// <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)
{
IEntityFactory2 factoryToUse = null;
switch(entityTypeToCreate)
{
case Datalib.EntityType.TblAgeGroupEntity:
factoryToUse = new TblAgeGroupEntityFactory();
break;
case Datalib.EntityType.TblAgencyEntity:
factoryToUse = new TblAgencyEntityFactory();
break;
case Datalib.EntityType.TblChildEntity:
factoryToUse = new TblChildEntityFactory();
break;
case Datalib.EntityType.TblClinicInfoEntity:
factoryToUse = new TblClinicInfoEntityFactory();
break;
case Datalib.EntityType.TblCommuneEntity:
factoryToUse = new TblCommuneEntityFactory();
break;
case Datalib.EntityType.TblDiaryEntity:
factoryToUse = new TblDiaryEntityFactory();
break;
case Datalib.EntityType.TblDistrictEntity:
factoryToUse = new TblDistrictEntityFactory();
break;
case Datalib.EntityType.TblExaminationInfoEntity:
factoryToUse = new TblExaminationInfoEntityFactory();
break;
case Datalib.EntityType.TblPatientEntity:
factoryToUse = new TblPatientEntityFactory();
break;
case Datalib.EntityType.TblPreClinicsInfoEntity:
factoryToUse = new TblPreClinicsInfoEntityFactory();
break;
case Datalib.EntityType.TblPregnanceInfoEntity:
factoryToUse = new TblPregnanceInfoEntityFactory();
break;
case Datalib.EntityType.TblProvinceEntity:
factoryToUse = new TblProvinceEntityFactory();
break;
case Datalib.EntityType.TblReferralFromPlaceEntity:
factoryToUse = new TblReferralFromPlaceEntityFactory();
break;
case Datalib.EntityType.TblReferralsToEntity:
factoryToUse = new TblReferralsToEntityFactory();
break;
case Datalib.EntityType.TblReferraltoServiceEntity:
factoryToUse = new TblReferraltoServiceEntityFactory();
break;
case Datalib.EntityType.TblRegimenEntity:
factoryToUse = new TblRegimenEntityFactory();
break;
case Datalib.EntityType.TblRegimenStopReasonEntity:
factoryToUse = new TblRegimenStopReasonEntityFactory();
break;
case Datalib.EntityType.TblServiceEntity:
factoryToUse = new TblServiceEntityFactory();
break;
case Datalib.EntityType.TblTestEntity:
factoryToUse = new TblTestEntityFactory();
break;
case Datalib.EntityType.TblTreatmentEntity:
factoryToUse = new TblTreatmentEntityFactory();
break;
case Datalib.EntityType.TblTreatmentInfoEntity:
factoryToUse = new TblTreatmentInfoEntityFactory();
break;
case Datalib.EntityType.TblWaitingListEntity:
factoryToUse = new TblWaitingListEntityFactory();
break;
}
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()
{
Array entityTypeValues = Enum.GetValues(typeof(Datalib.EntityType));
foreach(int entityTypeValue in entityTypeValues)
{
IEntity2 dummy = GeneralEntityFactory.Create((Datalib.EntityType)entityTypeValue);
_factoryPerType.Add(dummy.GetType(), dummy.GetEntityFactory());
}
}
/// <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)
{
IEntityFactory2 toReturn = null;
_factoryPerType.TryGetValue(typeOfEntity, out toReturn);
return toReturn;
}
/// <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)
{
return GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType());
}
}
/// <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);
}
/// <summary>Obtains the inheritance info provider instance from the singleton </summary>
/// <returns>The singleton instance of the inheritance info provider</returns>
public override IInheritanceInfoProvider ObtainInheritanceInfoProviderInstance()
{
return InheritanceInfoProviderSingleton.GetInstance();
}
/// <summary>Creates a new dynamic relation instance</summary>
/// <param name="leftOperand">The left operand.</param>
/// <returns>ready to use dynamic relation</returns>
public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand)
{
return new DynamicRelation(leftOperand);
}
/// <summary>Creates a new dynamic relation instance</summary>
/// <param name="leftOperand">The left operand.</param>
/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
/// <param name="rightOperand">The right operand.</param>
/// <param name="onClause">The on clause for the join.</param>
/// <returns>ready to use dynamic relation</returns>
public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, IPredicate onClause)
{
return new DynamicRelation(leftOperand, joinType, rightOperand, onClause);
}
/// <summary>Creates a new dynamic relation instance</summary>
/// <param name="leftOperand">The left operand.</param>
/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
/// <param name="rightOperand">The right operand.</param>
/// <param name="aliasLeftOperand">The alias of the left operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
/// <param name="onClause">The on clause for the join.</param>
/// <returns>ready to use dynamic relation</returns>
public override IDynamicRelation CreateDynamicRelation(IEntityFieldCore leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, string aliasLeftOperand, IPredicate onClause)
{
return new DynamicRelation(leftOperand, joinType, rightOperand, aliasLeftOperand, onClause);
}
/// <summary>Creates a new dynamic relation instance</summary>
/// <param name="leftOperand">The left operand.</param>
/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
/// <param name="onClause">The on clause for the join.</param>
/// <returns>ready to use dynamic relation</returns>
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);
}
/// <summary>Creates a new dynamic relation instance</summary>
/// <param name="leftOperandEntityName">Name of the entity which is used as the left operand.</param>
/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
/// <param name="aliasLeftOperand">The alias of the left operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
/// <param name="onClause">The on clause for the join.</param>
/// <returns>ready to use dynamic relation</returns>
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);
}
/// <summary>Creates a new dynamic relation instance</summary>
/// <param name="leftOperand">The left operand.</param>
/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
/// <param name="aliasLeftOperand">The alias of the left operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
/// <param name="onClause">The on clause for the join.</param>
/// <returns>ready to use dynamic relation</returns>
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);
}
/// <summary>Implementation of the routine which 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>
protected override IEntityFactoryCore GetFactoryImpl(int entityTypeValue)
{
return EntityFactoryFactory.GetFactory((Datalib.EntityType)entityTypeValue);
}
/// <summary>Implementation of the routine which 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>
protected override IEntityFactoryCore GetFactoryImpl(Type typeOfEntity)
{
return EntityFactoryFactory.GetFactory(typeOfEntity);
}
}
}