Exemplo n.º 1
0
 /// <summary> Retrieves the related entity of type 'OrganEntity', using a relation of type 'n:1'</summary>
 /// <param name="forceFetch">if true, it will discard any changes currently in the currently loaded related entity and will refetch the entity from the persistent storage</param>
 /// <returns>A fetched entity of type 'OrganEntity' which is related to this entity.</returns>
 public virtual OrganEntity GetSingleOrgan(bool forceFetch)
 {
     if ((!_alreadyFetchedOrgan || forceFetch || _alwaysFetchOrgan) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool        performLazyLoading = this.CheckIfLazyLoadingShouldOccur(Relations.OrganEntityUsingOrganId);
         OrganEntity newEntity          = new OrganEntity();
         bool        fetchResult        = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.OrganId);
         }
         if (fetchResult)
         {
             newEntity = (OrganEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_organReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Organ           = newEntity;
         _alreadyFetchedOrgan = fetchResult;
     }
     return(_organ);
 }
Exemplo n.º 2
0
 /// <summary> setups the sync logic for member _organ</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncOrgan(IEntityCore relatedEntity)
 {
     if (_organ != relatedEntity)
     {
         DesetupSyncOrgan(true, true);
         _organ = (OrganEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_organ, new PropertyChangedEventHandler(OnOrganPropertyChanged), "Organ", EPICCentralDL.RelationClasses.StaticSeverityRelations.OrganEntityUsingOrganIdStatic, true, ref _alreadyFetchedOrgan, new string[] {  });
     }
 }
Exemplo n.º 3
0
        /// <summary>Private CTor for deserialization</summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected SeverityEntity(SerializationInfo info, StreamingContext context) : base(info, context)
        {
            _organ = (OrganEntity)info.GetValue("_organ", typeof(OrganEntity));
            if (_organ != null)
            {
                _organ.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _organReturnsNewIfNotFound = info.GetBoolean("_organReturnsNewIfNotFound");
            _alwaysFetchOrgan          = info.GetBoolean("_alwaysFetchOrgan");
            _alreadyFetchedOrgan       = info.GetBoolean("_alreadyFetchedOrgan");

            _treatment = (TreatmentEntity)info.GetValue("_treatment", typeof(TreatmentEntity));
            if (_treatment != null)
            {
                _treatment.AfterSave += new EventHandler(OnEntityAfterSave);
            }
            _treatmentReturnsNewIfNotFound = info.GetBoolean("_treatmentReturnsNewIfNotFound");
            _alwaysFetchTreatment          = info.GetBoolean("_alwaysFetchTreatment");
            _alreadyFetchedTreatment       = info.GetBoolean("_alreadyFetchedTreatment");
            this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
            // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
            // __LLBLGENPRO_USER_CODE_REGION_END
        }
Exemplo n.º 4
0
 /// <summary> Removes the sync logic for member _organ</summary>
 /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param>
 /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param>
 private void DesetupSyncOrgan(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_organ, new PropertyChangedEventHandler(OnOrganPropertyChanged), "Organ", EPICCentralDL.RelationClasses.StaticSeverityRelations.OrganEntityUsingOrganIdStatic, true, signalRelatedEntity, "Severities", resetFKFields, new int[] { (int)SeverityFieldIndex.OrganId });
     _organ = null;
 }