///////////////////////////////////////////////////////////////
// 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
/// general base class for the generated factories
[Serializable]
public partial class EntityFactoryBase2 : EntityFactoryCore2
where TEntity : EntityBase2, IEntity2
{
private readonly Datalib.EntityType _typeOfEntity;
private readonly bool _isInHierarchy;
/// CTor
/// Name of the entity.
/// The type of entity.
/// If true, the entity of this factory is in an inheritance hierarchy, false otherwise
public EntityFactoryBase2(string entityName, Datalib.EntityType typeOfEntity, bool isInHierarchy) : base(entityName)
{
_typeOfEntity = typeOfEntity;
_isInHierarchy = isInHierarchy;
}
/// Creates, using the generated EntityFieldsFactory, the IEntityFields2 object for the entity to create.
/// Empty IEntityFields2 object.
public override IEntityFields2 CreateFields()
{
return EntityFieldsFactory.CreateEntityFieldsObject(_typeOfEntity);
}
/// Creates a new entity instance using the GeneralEntityFactory in the generated code, using the passed in entitytype value
/// The entity type value of the entity to create an instance for.
/// new IEntity instance
public override IEntity2 CreateEntityFromEntityTypeValue(int entityTypeValue)
{
return GeneralEntityFactory.Create((Datalib.EntityType)entityTypeValue);
}
/// Creates the relations collection to the entity to join all targets so this entity can be fetched.
/// The object alias to use for the elements in the relations.
/// 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
public override IRelationCollection CreateHierarchyRelations(string objectAlias)
{
return InheritanceInfoProviderSingleton.GetInstance().GetHierarchyRelations(this.ForEntityName, objectAlias);
}
/// This method retrieves, using the InheritanceInfoprovider, the factory for the entity represented by the values passed in.
/// Field values read from the db, to determine which factory to return, based on the field values passed in.
/// indexes into values where per entity type their own fields start.
/// the factory for the entity which is represented by the values passed in.
public override IEntityFactory2 GetEntityFactory(object[] fieldValues, Dictionary entityFieldStartIndexesPerEntity)
{
IEntityFactory2 toReturn = (IEntityFactory2)InheritanceInfoProviderSingleton.GetInstance().GetEntityFactory(this.ForEntityName, fieldValues, entityFieldStartIndexesPerEntity);
if(toReturn == null)
{
toReturn = this;
}
return toReturn;
}
/// Gets a predicateexpression which filters on the entity with type belonging to this factory.
/// Flag to produce a NOT filter, (true), or a normal filter (false).
/// The object alias to use for the predicate(s).
/// ready to use predicateexpression, or an empty predicate expression if the belonging entity isn't a hierarchical type.
public override IPredicateExpression GetEntityTypeFilter(bool negate, string objectAlias)
{
return InheritanceInfoProviderSingleton.GetInstance().GetEntityTypeFilter(this.ForEntityName, objectAlias, negate);
}
/// Creates a new generic EntityCollection(Of T) for the entity which this factory belongs to.
/// ready to use generic EntityCollection(Of T) with this factory set as the factory
public override IEntityCollection2 CreateEntityCollection()
{
return new EntityCollection(this);
}
/// Creates the hierarchy fields for the entity to which this factory belongs.
/// 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.
public override IEntityFields2 CreateHierarchyFields()
{
return _isInHierarchy ? new EntityFields2(InheritanceInfoProviderSingleton.GetInstance().GetHierarchyFields(this.ForEntityName), InheritanceInfoProviderSingleton.GetInstance(), null) : base.CreateHierarchyFields();
}
}
/// Factory to create new, empty TblAgeGroupEntity objects.
[Serializable]
public partial class TblAgeGroupEntityFactory : EntityFactoryBase2 {
/// CTor
public TblAgeGroupEntityFactory() : base("TblAgeGroupEntity", Datalib.EntityType.TblAgeGroupEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblAgencyEntity objects.
[Serializable]
public partial class TblAgencyEntityFactory : EntityFactoryBase2 {
/// CTor
public TblAgencyEntityFactory() : base("TblAgencyEntity", Datalib.EntityType.TblAgencyEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblChildEntity objects.
[Serializable]
public partial class TblChildEntityFactory : EntityFactoryBase2 {
/// CTor
public TblChildEntityFactory() : base("TblChildEntity", Datalib.EntityType.TblChildEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblClinicInfoEntity objects.
[Serializable]
public partial class TblClinicInfoEntityFactory : EntityFactoryBase2 {
/// CTor
public TblClinicInfoEntityFactory() : base("TblClinicInfoEntity", Datalib.EntityType.TblClinicInfoEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblCommuneEntity objects.
[Serializable]
public partial class TblCommuneEntityFactory : EntityFactoryBase2 {
/// CTor
public TblCommuneEntityFactory() : base("TblCommuneEntity", Datalib.EntityType.TblCommuneEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblDiaryEntity objects.
[Serializable]
public partial class TblDiaryEntityFactory : EntityFactoryBase2 {
/// CTor
public TblDiaryEntityFactory() : base("TblDiaryEntity", Datalib.EntityType.TblDiaryEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblDistrictEntity objects.
[Serializable]
public partial class TblDistrictEntityFactory : EntityFactoryBase2 {
/// CTor
public TblDistrictEntityFactory() : base("TblDistrictEntity", Datalib.EntityType.TblDistrictEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblExaminationInfoEntity objects.
[Serializable]
public partial class TblExaminationInfoEntityFactory : EntityFactoryBase2 {
/// CTor
public TblExaminationInfoEntityFactory() : base("TblExaminationInfoEntity", Datalib.EntityType.TblExaminationInfoEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblPatientEntity objects.
[Serializable]
public partial class TblPatientEntityFactory : EntityFactoryBase2 {
/// CTor
public TblPatientEntityFactory() : base("TblPatientEntity", Datalib.EntityType.TblPatientEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblPreClinicsInfoEntity objects.
[Serializable]
public partial class TblPreClinicsInfoEntityFactory : EntityFactoryBase2 {
/// CTor
public TblPreClinicsInfoEntityFactory() : base("TblPreClinicsInfoEntity", Datalib.EntityType.TblPreClinicsInfoEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblPregnanceInfoEntity objects.
[Serializable]
public partial class TblPregnanceInfoEntityFactory : EntityFactoryBase2 {
/// CTor
public TblPregnanceInfoEntityFactory() : base("TblPregnanceInfoEntity", Datalib.EntityType.TblPregnanceInfoEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblProvinceEntity objects.
[Serializable]
public partial class TblProvinceEntityFactory : EntityFactoryBase2 {
/// CTor
public TblProvinceEntityFactory() : base("TblProvinceEntity", Datalib.EntityType.TblProvinceEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblReferralFromPlaceEntity objects.
[Serializable]
public partial class TblReferralFromPlaceEntityFactory : EntityFactoryBase2 {
/// CTor
public TblReferralFromPlaceEntityFactory() : base("TblReferralFromPlaceEntity", Datalib.EntityType.TblReferralFromPlaceEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblReferralsToEntity objects.
[Serializable]
public partial class TblReferralsToEntityFactory : EntityFactoryBase2 {
/// CTor
public TblReferralsToEntityFactory() : base("TblReferralsToEntity", Datalib.EntityType.TblReferralsToEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblReferraltoServiceEntity objects.
[Serializable]
public partial class TblReferraltoServiceEntityFactory : EntityFactoryBase2 {
/// CTor
public TblReferraltoServiceEntityFactory() : base("TblReferraltoServiceEntity", Datalib.EntityType.TblReferraltoServiceEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblRegimenEntity objects.
[Serializable]
public partial class TblRegimenEntityFactory : EntityFactoryBase2 {
/// CTor
public TblRegimenEntityFactory() : base("TblRegimenEntity", Datalib.EntityType.TblRegimenEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblRegimenStopReasonEntity objects.
[Serializable]
public partial class TblRegimenStopReasonEntityFactory : EntityFactoryBase2 {
/// CTor
public TblRegimenStopReasonEntityFactory() : base("TblRegimenStopReasonEntity", Datalib.EntityType.TblRegimenStopReasonEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblServiceEntity objects.
[Serializable]
public partial class TblServiceEntityFactory : EntityFactoryBase2 {
/// CTor
public TblServiceEntityFactory() : base("TblServiceEntity", Datalib.EntityType.TblServiceEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblTestEntity objects.
[Serializable]
public partial class TblTestEntityFactory : EntityFactoryBase2 {
/// CTor
public TblTestEntityFactory() : base("TblTestEntity", Datalib.EntityType.TblTestEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblTreatmentEntity objects.
[Serializable]
public partial class TblTreatmentEntityFactory : EntityFactoryBase2 {
/// CTor
public TblTreatmentEntityFactory() : base("TblTreatmentEntity", Datalib.EntityType.TblTreatmentEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblTreatmentInfoEntity objects.
[Serializable]
public partial class TblTreatmentInfoEntityFactory : EntityFactoryBase2 {
/// CTor
public TblTreatmentInfoEntityFactory() : base("TblTreatmentInfoEntity", Datalib.EntityType.TblTreatmentInfoEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty TblWaitingListEntity objects.
[Serializable]
public partial class TblWaitingListEntityFactory : EntityFactoryBase2 {
/// CTor
public TblWaitingListEntityFactory() : base("TblWaitingListEntity", Datalib.EntityType.TblWaitingListEntity, false) { }
/// 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.
/// Populated IEntityFields2 object for the new IEntity2 to create
/// Fully created and populated (due to the IEntityFields2 object) IEntity2 object
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
}
/// Factory to create new, empty Entity objects based on the entity type specified. Uses entity specific factory objects
[Serializable]
public partial class GeneralEntityFactory
{
/// Creates a new, empty Entity object of the type specified
/// The entity type to create.
/// A new, empty Entity object.
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;
}
}
/// Class which is used to obtain the entity factory based on the .NET type of the entity.
[Serializable]
public static class EntityFactoryFactory
{
private static Dictionary _factoryPerType = new Dictionary();
/// Initializes the class.
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());
}
}
/// Gets the factory of the entity with the .NET type specified
/// The type of entity.
/// factory to use or null if not found
public static IEntityFactory2 GetFactory(Type typeOfEntity)
{
IEntityFactory2 toReturn = null;
_factoryPerType.TryGetValue(typeOfEntity, out toReturn);
return toReturn;
}
/// Gets the factory of the entity with the Datalib.EntityType specified
/// The type of entity.
/// factory to use or null if not found
public static IEntityFactory2 GetFactory(Datalib.EntityType typeOfEntity)
{
return GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType());
}
}
/// Element creator for creating project elements from somewhere else, like inside Linq providers.
public class ElementCreator : ElementCreatorBase, IElementCreator2
{
/// Gets the factory of the Entity type with the Datalib.EntityType value passed in
/// The entity type value.
/// the entity factory of the entity type or null if not found
public IEntityFactory2 GetFactory(int entityTypeValue)
{
return (IEntityFactory2)this.GetFactoryImpl(entityTypeValue);
}
/// Gets the factory of the Entity type with the .NET type passed in
/// The type of entity.
/// the entity factory of the entity type or null if not found
public IEntityFactory2 GetFactory(Type typeOfEntity)
{
return (IEntityFactory2)this.GetFactoryImpl(typeOfEntity);
}
/// Creates a new resultset fields object with the number of field slots reserved as specified
/// The number of fields.
/// ready to use resultsetfields object
public IEntityFields2 CreateResultsetFields(int numberOfFields)
{
return new ResultsetFields(numberOfFields);
}
/// Obtains the inheritance info provider instance from the singleton
/// The singleton instance of the inheritance info provider
public override IInheritanceInfoProvider ObtainInheritanceInfoProviderInstance()
{
return InheritanceInfoProviderSingleton.GetInstance();
}
/// Creates a new dynamic relation instance
/// The left operand.
/// ready to use dynamic relation
public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand)
{
return new DynamicRelation(leftOperand);
}
/// Creates a new dynamic relation instance
/// The left operand.
/// Type of the join. If None is specified, Inner is assumed.
/// The right operand.
/// The on clause for the join.
/// ready to use dynamic relation
public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, IPredicate onClause)
{
return new DynamicRelation(leftOperand, joinType, rightOperand, onClause);
}
/// Creates a new dynamic relation instance
/// The left operand.
/// Type of the join. If None is specified, Inner is assumed.
/// The right operand.
/// 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.
/// The on clause for the join.
/// ready to use dynamic relation
public override IDynamicRelation CreateDynamicRelation(IEntityFieldCore leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, string aliasLeftOperand, IPredicate onClause)
{
return new DynamicRelation(leftOperand, joinType, rightOperand, aliasLeftOperand, onClause);
}
/// Creates a new dynamic relation instance
/// The left operand.
/// Type of the join. If None is specified, Inner is assumed.
/// Name of the entity, which is used as the right operand.
/// 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.
/// The on clause for the join.
/// ready to use dynamic relation
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);
}
/// Creates a new dynamic relation instance
/// Name of the entity which is used as the left operand.
/// Type of the join. If None is specified, Inner is assumed.
/// Name of the entity, which is used as the right operand.
/// 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.
/// 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.
/// The on clause for the join.
/// ready to use dynamic relation
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);
}
/// Creates a new dynamic relation instance
/// The left operand.
/// Type of the join. If None is specified, Inner is assumed.
/// Name of the entity, which is used as the right operand.
/// 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.
/// 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.
/// The on clause for the join.
/// ready to use dynamic relation
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);
}
/// Implementation of the routine which gets the factory of the Entity type with the Datalib.EntityType value passed in
/// The entity type value.
/// the entity factory of the entity type or null if not found
protected override IEntityFactoryCore GetFactoryImpl(int entityTypeValue)
{
return EntityFactoryFactory.GetFactory((Datalib.EntityType)entityTypeValue);
}
/// Implementation of the routine which gets the factory of the Entity type with the .NET type passed in
/// The type of entity.
/// the entity factory of the entity type or null if not found
protected override IEntityFactoryCore GetFactoryImpl(Type typeOfEntity)
{
return EntityFactoryFactory.GetFactory(typeOfEntity);
}
}
}