Example #1
0
        public override void NotifyDeleting()
        {
            base.NotifyDeleting();
            if (OnNotifyDeleting_One_to_N_relations_N != null)
            {
                OnNotifyDeleting_One_to_N_relations_N(this);
            }

            // FK_OneSide_connectsTo_NSide
            if (OneSide != null)
            {
                ((NHibernatePersistenceObject)OneSide).ChildrenToDelete.Add(this);
                ParentsToDelete.Add((NHibernatePersistenceObject)OneSide);
            }

            OneSide = null;
        }
Example #2
0
        public override void ReloadReferences()
        {
            // Do not reload references if the current object has been deleted.
            // TODO: enable when MemoryContext uses MemoryDataObjects
            //if (this.ObjectState == DataObjectState.Deleted) return;
            base.ReloadReferences();

            // fix direct object references

            if (_fk_OneSide.HasValue)
            {
                this.OneSide = ((Zetbox.App.Test.One_to_N_relations_OneNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Test.One_to_N_relations_One>(_fk_OneSide.Value));
            }
            else
            {
                this.OneSide = null;
            }
        }
Example #3
0
        public override void UpdateParent(string propertyName, IDataObject parentObj)
        {
            switch (propertyName)
            {
            case "OneSide":
            {
                var __oldValue = (Zetbox.App.Test.One_to_N_relations_OneNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.OneSide);
                var __newValue = (Zetbox.App.Test.One_to_N_relations_OneNHibernateImpl)parentObj;
                NotifyPropertyChanging("OneSide", __oldValue, __newValue);
                this.Proxy.OneSide = __newValue == null ? null : __newValue.Proxy;
                NotifyPropertyChanged("OneSide", __oldValue, __newValue);
            }
            break;

            default:
                base.UpdateParent(propertyName, parentObj);
                break;
            }
        }