예제 #1
0
 /// <summary> Retrieves the related entity of type 'OrganizationEntity', 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 'OrganizationEntity' which is related to this entity.</returns>
 public virtual OrganizationEntity GetSingleOrganization(bool forceFetch)
 {
     if ((!_alreadyFetchedOrganization || forceFetch || _alwaysFetchOrganization) && !this.IsSerializing && !this.IsDeserializing && !this.InDesignMode)
     {
         bool performLazyLoading      = this.CheckIfLazyLoadingShouldOccur(Relations.OrganizationEntityUsingOrganizationId);
         OrganizationEntity newEntity = new OrganizationEntity();
         bool fetchResult             = false;
         if (performLazyLoading)
         {
             AddToTransactionIfNecessary(newEntity);
             fetchResult = newEntity.FetchUsingPK(this.OrganizationId);
         }
         if (fetchResult)
         {
             newEntity = (OrganizationEntity)GetFromActiveContext(newEntity);
         }
         else
         {
             if (!_organizationReturnsNewIfNotFound)
             {
                 RemoveFromTransactionIfNecessary(newEntity);
                 newEntity = null;
             }
         }
         this.Organization           = newEntity;
         _alreadyFetchedOrganization = fetchResult;
     }
     return(_organization);
 }
예제 #2
0
 /// <summary> setups the sync logic for member _organization</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncOrganization(IEntityCore relatedEntity)
 {
     if (_organization != relatedEntity)
     {
         DesetupSyncOrganization(true, true);
         _organization = (OrganizationEntity)relatedEntity;
         this.PerformSetupSyncRelatedEntity(_organization, new PropertyChangedEventHandler(OnOrganizationPropertyChanged), "Organization", EPICCentralDL.RelationClasses.StaticContactRelations.OrganizationEntityUsingOrganizationIdStatic, true, ref _alreadyFetchedOrganization, new string[] {  });
     }
 }
예제 #3
0
 /// <summary>Private CTor for deserialization</summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected ContactEntity(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     _organization = (OrganizationEntity)info.GetValue("_organization", typeof(OrganizationEntity));
     if (_organization != null)
     {
         _organization.AfterSave += new EventHandler(OnEntityAfterSave);
     }
     _organizationReturnsNewIfNotFound = info.GetBoolean("_organizationReturnsNewIfNotFound");
     _alwaysFetchOrganization          = info.GetBoolean("_alwaysFetchOrganization");
     _alreadyFetchedOrganization       = info.GetBoolean("_alreadyFetchedOrganization");
     this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
     // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
     // __LLBLGENPRO_USER_CODE_REGION_END
 }
예제 #4
0
 /// <summary> Removes the sync logic for member _organization</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 DesetupSyncOrganization(bool signalRelatedEntity, bool resetFKFields)
 {
     this.PerformDesetupSyncRelatedEntity(_organization, new PropertyChangedEventHandler(OnOrganizationPropertyChanged), "Organization", EPICCentralDL.RelationClasses.StaticContactRelations.OrganizationEntityUsingOrganizationIdStatic, true, signalRelatedEntity, "Contacts", resetFKFields, new int[] { (int)ContactFieldIndex.OrganizationId });
     _organization = null;
 }