/////////////////////////////////////////////////////////////// // 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.ComponentModel; using System.Collections.Generic; #if !CF using System.Runtime.Serialization; #endif using System.Xml.Serialization; using Datalib; 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 'TblAgency'.

[Serializable] public partial class TblAgencyEntity : CommonEntityBase // __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces // __LLBLGENPRO_USER_CODE_REGION_END { #region Class Member Declarations private EntityCollection _tblReferraltoServices; // __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers // __LLBLGENPRO_USER_CODE_REGION_END #endregion #region Statics private static Dictionary _customProperties; private static Dictionary> _fieldsCustomProperties; /// All names of fields mapped onto a relation. Usable for in-memory filtering public static partial class MemberNames { /// Member name TblReferraltoServices public static readonly string TblReferraltoServices = "TblReferraltoServices"; } #endregion /// Static CTor for setting up custom property hashtables. Is executed before the first instance of this entity class or derived classes is constructed. static TblAgencyEntity() { SetupCustomPropertyHashtables(); } /// CTor public TblAgencyEntity():base("TblAgencyEntity") { InitClassEmpty(null, null); } /// CTor /// For framework usage. /// Fields object to set as the fields for this entity. public TblAgencyEntity(IEntityFields2 fields):base("TblAgencyEntity") { InitClassEmpty(null, fields); } /// CTor /// The custom validator object for this TblAgencyEntity public TblAgencyEntity(IValidator validator):base("TblAgencyEntity") { InitClassEmpty(validator, null); } /// CTor /// PK value for TblAgency which data should be fetched into this TblAgency object /// The entity is not fetched by this constructor. Use a DataAccessAdapter for that. public TblAgencyEntity(System.String agencyTypeId):base("TblAgencyEntity") { InitClassEmpty(null, null); this.AgencyTypeId = agencyTypeId; } /// CTor /// PK value for TblAgency which data should be fetched into this TblAgency object /// The custom validator object for this TblAgencyEntity /// The entity is not fetched by this constructor. Use a DataAccessAdapter for that. public TblAgencyEntity(System.String agencyTypeId, IValidator validator):base("TblAgencyEntity") { InitClassEmpty(validator, null); this.AgencyTypeId = agencyTypeId; } /// Protected CTor for deserialization /// /// [EditorBrowsable(EditorBrowsableState.Never)] protected TblAgencyEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _tblReferraltoServices = (EntityCollection)info.GetValue("_tblReferraltoServices", typeof(EntityCollection)); this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END } /// Sets the related entity property to the entity specified. If the property is a collection, it will add the entity specified to that collection. /// Name of the property. /// Entity to set as an related entity /// Used by prefetch path logic. protected override void SetRelatedEntityProperty(string propertyName, IEntityCore entity) { switch(propertyName) { case "TblReferraltoServices": this.TblReferraltoServices.Add((TblReferraltoServiceEntity)entity); break; default: this.OnSetRelatedEntityProperty(propertyName, entity); break; } } /// Gets the relation objects which represent the relation the fieldName specified is mapped on. /// Name of the field mapped onto the relation of which the relation objects have to be obtained. /// RelationCollection with relation object(s) which represent the relation the field is maped on protected override RelationCollection GetRelationsForFieldOfType(string fieldName) { return GetRelationsForField(fieldName); } /// Gets the relation objects which represent the relation the fieldName specified is mapped on. /// Name of the field mapped onto the relation of which the relation objects have to be obtained. /// RelationCollection with relation object(s) which represent the relation the field is maped on internal static RelationCollection GetRelationsForField(string fieldName) { RelationCollection toReturn = new RelationCollection(); switch(fieldName) { case "TblReferraltoServices": toReturn.Add(Relations.TblReferraltoServiceEntityUsingAgencyTypeId); break; default: break; } return toReturn; } #if !CF /// Checks if the relation mapped by the property with the name specified is a one way / single sided relation. If the passed in name is null, it/ will return true if the entity has any single-sided relation /// Name of the property which is mapped onto the relation to check, or null to check if the entity has any relation/ which is single sided /// true if the relation is single sided / one way (so the opposite relation isn't present), false otherwise protected override bool CheckOneWayRelations(string propertyName) { int numberOfOneWayRelations = 0; switch(propertyName) { case null: return ((numberOfOneWayRelations > 0) || base.CheckOneWayRelations(null)); default: return base.CheckOneWayRelations(propertyName); } } #endif /// Sets the internal parameter related to the fieldname passed to the instance relatedEntity. /// Instance to set as the related entity of type entityType /// Name of field mapped onto the relation which resolves in the instance relatedEntity protected override void SetRelatedEntity(IEntityCore relatedEntity, string fieldName) { switch(fieldName) { case "TblReferraltoServices": this.TblReferraltoServices.Add((TblReferraltoServiceEntity)relatedEntity); break; default: break; } } /// Unsets the internal parameter related to the fieldname passed to the instance relatedEntity. Reverses the actions taken by SetRelatedEntity() /// Instance to unset as the related entity of type entityType /// Name of field mapped onto the relation which resolves in the instance relatedEntity /// if set to true it will notify the manytoone side, if applicable. protected override void UnsetRelatedEntity(IEntityCore relatedEntity, string fieldName, bool signalRelatedEntityManyToOne) { switch(fieldName) { case "TblReferraltoServices": this.PerformRelatedEntityRemoval(this.TblReferraltoServices, relatedEntity, signalRelatedEntityManyToOne); break; default: break; } } /// Gets a collection of related entities referenced by this entity which depend on this entity (this entity is the PK side of their FK fields). These entities will have to be persisted after this entity during a recursive save. /// Collection with 0 or more IEntity2 objects, referenced by this entity protected override List GetDependingRelatedEntities() { List toReturn = new List(); return toReturn; } /// Gets a collection of related entities referenced by this entity which this entity depends on (this entity is the FK side of their PK fields). These /// entities will have to be persisted before this entity during a recursive save. /// Collection with 0 or more IEntity2 objects, referenced by this entity protected override List GetDependentRelatedEntities() { List toReturn = new List(); return toReturn; } /// Gets a list of all entity collections stored as member variables in this entity. Only 1:n related collections are returned. /// Collection with 0 or more IEntityCollection2 objects, referenced by this entity protected override List GetMemberEntityCollections() { List toReturn = new List(); toReturn.Add(this.TblReferraltoServices); return toReturn; } /// ISerializable member. Does custom serialization so event handlers do not get serialized. Serializes members of this entity class and uses the base class' implementation to serialize the rest. /// /// [EditorBrowsable(EditorBrowsableState.Never)] protected override void GetObjectData(SerializationInfo info, StreamingContext context) { if (SerializationHelper.Optimization != SerializationOptimization.Fast) { info.AddValue("_tblReferraltoServices", ((_tblReferraltoServices!=null) && (_tblReferraltoServices.Count>0) && !this.MarkedForDeletion)?_tblReferraltoServices:null); } // __LLBLGENPRO_USER_CODE_REGION_START GetObjectInfo // __LLBLGENPRO_USER_CODE_REGION_END base.GetObjectData(info, context); } /// Gets a list of all the EntityRelation objects the type of this instance has. /// A list of all the EntityRelation objects the type of this instance has. Hierarchy relations are excluded. protected override List GetAllRelations() { return new TblAgencyRelations().GetAllRelations(); } /// Creates a new IRelationPredicateBucket object which contains the predicate expression and relation collection to fetch the related entities of type 'TblReferraltoService' to this entity. /// public virtual IRelationPredicateBucket GetRelationInfoTblReferraltoServices() { IRelationPredicateBucket bucket = new RelationPredicateBucket(); bucket.PredicateExpression.Add(new FieldCompareValuePredicate(TblReferraltoServiceFields.AgencyTypeId, null, ComparisonOperator.Equal, this.AgencyTypeId)); return bucket; } /// Creates a new instance of the factory related to this entity protected override IEntityFactory2 CreateEntityFactory() { return EntityFactoryCache2.GetEntityFactory(typeof(TblAgencyEntityFactory)); } #if !CF /// Adds the member collections to the collections queue (base first) /// The collections queue. protected override void AddToMemberEntityCollectionsQueue(Queue collectionsQueue) { base.AddToMemberEntityCollectionsQueue(collectionsQueue); collectionsQueue.Enqueue(this._tblReferraltoServices); } /// Gets the member collections queue from the queue (base first) /// The collections queue. protected override void GetFromMemberEntityCollectionsQueue(Queue collectionsQueue) { base.GetFromMemberEntityCollectionsQueue(collectionsQueue); this._tblReferraltoServices = (EntityCollection) collectionsQueue.Dequeue(); } /// Determines whether the entity has populated member collections /// true if the entity has populated member collections. protected override bool HasPopulatedMemberEntityCollections() { bool toReturn = false; toReturn |=(this._tblReferraltoServices != null); return toReturn ? true : base.HasPopulatedMemberEntityCollections(); } /// Creates the member entity collections queue. /// The collections queue. /// The required queue. protected override void CreateMemberEntityCollectionsQueue(Queue collectionsQueue, Queue requiredQueue) { base.CreateMemberEntityCollectionsQueue(collectionsQueue, requiredQueue); collectionsQueue.Enqueue(requiredQueue.Dequeue() ? new EntityCollection(EntityFactoryCache2.GetEntityFactory(typeof(TblReferraltoServiceEntityFactory))) : null); } #endif /// Gets all related data objects, stored by name. The name is the field name mapped onto the relation for that particular data element. /// Dictionary with per name the related referenced data element, which can be an entity collection or an entity or null protected override Dictionary GetRelatedData() { Dictionary toReturn = new Dictionary(); toReturn.Add("TblReferraltoServices", _tblReferraltoServices); return toReturn; } /// Initializes the class members private void InitClassMembers() { PerformDependencyInjection(); // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers // __LLBLGENPRO_USER_CODE_REGION_END OnInitClassMembersComplete(); } #region Custom Property Hashtable Setup /// Initializes the hashtables for the entity type and entity field custom properties. private static void SetupCustomPropertyHashtables() { _customProperties = new Dictionary(); _fieldsCustomProperties = new Dictionary>(); Dictionary fieldHashtable; fieldHashtable = new Dictionary(); _fieldsCustomProperties.Add("AgencyTypeId", fieldHashtable); fieldHashtable = new Dictionary(); _fieldsCustomProperties.Add("EAgencyTypeName", fieldHashtable); fieldHashtable = new Dictionary(); _fieldsCustomProperties.Add("VAgencyTypeName", fieldHashtable); } #endregion /// Initializes the class with empty data, as if it is a new Entity. /// The validator object for this TblAgencyEntity /// 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(); } #region Class Property Declarations /// The relations object holding all relations of this entity with other entity classes. public static TblAgencyRelations Relations { get { return new TblAgencyRelations(); } } /// The custom properties for this entity type. /// The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime. public static Dictionary CustomProperties { get { return _customProperties;} } /// Creates a new PrefetchPathElement2 object which contains all the information to prefetch the related entities of type 'TblReferraltoService' for this entity. /// Ready to use IPrefetchPathElement2 implementation. public static IPrefetchPathElement2 PrefetchPathTblReferraltoServices { get { return new PrefetchPathElement2( new EntityCollection(EntityFactoryCache2.GetEntityFactory(typeof(TblReferraltoServiceEntityFactory))), (IEntityRelation)GetRelationsForField("TblReferraltoServices")[0], (int)Datalib.EntityType.TblAgencyEntity, (int)Datalib.EntityType.TblReferraltoServiceEntity, 0, null, null, null, null, "TblReferraltoServices", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany); } } /// The custom properties for the type of this entity instance. /// The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime. [Browsable(false), XmlIgnore] protected override Dictionary CustomPropertiesOfType { get { return CustomProperties;} } /// The custom properties for the fields of this entity type. The returned Hashtable contains per fieldname a hashtable of name-value pairs. /// The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime. public static Dictionary> FieldsCustomProperties { get { return _fieldsCustomProperties;} } /// The custom properties for the fields of the type of this entity instance. The returned Hashtable contains per fieldname a hashtable of name-value pairs. /// The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime. [Browsable(false), XmlIgnore] protected override Dictionary> FieldsCustomPropertiesOfType { get { return FieldsCustomProperties;} } /// The AgencyTypeId property of the Entity TblAgency

/// Mapped on table field: "tblAgency"."AgencyTypeID"
/// 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 AgencyTypeId { get { return (System.String)GetValue((int)TblAgencyFieldIndex.AgencyTypeId, true); } set { SetValue((int)TblAgencyFieldIndex.AgencyTypeId, value); } } /// The EAgencyTypeName property of the Entity TblAgency

/// Mapped on table field: "tblAgency"."eAgencyTypeName"
/// Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 255
/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String EAgencyTypeName { get { return (System.String)GetValue((int)TblAgencyFieldIndex.EAgencyTypeName, true); } set { SetValue((int)TblAgencyFieldIndex.EAgencyTypeName, value); } } /// The VAgencyTypeName property of the Entity TblAgency

/// Mapped on table field: "tblAgency"."vAgencyTypeName"
/// Table field type characteristics (type, precision, scale, length): VarWChar, 0, 0, 255
/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false
public virtual System.String VAgencyTypeName { get { return (System.String)GetValue((int)TblAgencyFieldIndex.VAgencyTypeName, true); } set { SetValue((int)TblAgencyFieldIndex.VAgencyTypeName, value); } } /// Gets the EntityCollection with the related entities of type 'TblReferraltoServiceEntity' 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(TblReferraltoServiceEntity))] public virtual EntityCollection TblReferraltoServices { get { return GetOrCreateEntityCollection("TblAgency", true, false, ref _tblReferraltoServices); } } /// Gets the type of the hierarchy this entity is in. protected override InheritanceHierarchyType LLBLGenProIsInHierarchyOfType { get { return InheritanceHierarchyType.None;} } /// Gets or sets a value indicating whether this entity is a subtype protected override bool LLBLGenProIsSubType { get { return false;} } /// Returns the Datalib.EntityType enum value for this entity. [Browsable(false), XmlIgnore] protected override int LLBLGenProEntityTypeValue { get { return (int)Datalib.EntityType.TblAgencyEntity; } } #endregion #region Custom Entity code // __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode // __LLBLGENPRO_USER_CODE_REGION_END #endregion #region Included code #endregion } }