예제 #1
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_ChangedBy.HasValue)
            {
                this.ChangedBy = ((Zetbox.App.Base.IdentityNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Identity>(_fk_ChangedBy.Value));
            }
            else
            {
                this.ChangedBy = null;
            }

            if (_fk_CreatedBy.HasValue)
            {
                this.CreatedBy = ((Zetbox.App.Base.IdentityNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Identity>(_fk_CreatedBy.Value));
            }
            else
            {
                this.CreatedBy = null;
            }

            if (_fk_guid_Module.HasValue)
            {
                this.Module = ((Zetbox.App.Base.ModuleNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Module>(_fk_guid_Module.Value));
            }
            else
            if (_fk_Module.HasValue)
            {
                this.Module = ((Zetbox.App.Base.ModuleNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Module>(_fk_Module.Value));
            }
            else
            {
                this.Module = null;
            }
        }
예제 #2
0
        public override void UpdateParent(string propertyName, IDataObject parentObj)
        {
            switch (propertyName)
            {
            case "ChangedBy":
            {
                var __oldValue = (Zetbox.App.Base.IdentityNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.ChangedBy);
                var __newValue = (Zetbox.App.Base.IdentityNHibernateImpl)parentObj;
                NotifyPropertyChanging("ChangedBy", __oldValue, __newValue);
                this.Proxy.ChangedBy = __newValue == null ? null : __newValue.Proxy;
                NotifyPropertyChanged("ChangedBy", __oldValue, __newValue);
            }
            break;

            case "CreatedBy":
            {
                var __oldValue = (Zetbox.App.Base.IdentityNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.CreatedBy);
                var __newValue = (Zetbox.App.Base.IdentityNHibernateImpl)parentObj;
                NotifyPropertyChanging("CreatedBy", __oldValue, __newValue);
                this.Proxy.CreatedBy = __newValue == null ? null : __newValue.Proxy;
                NotifyPropertyChanged("CreatedBy", __oldValue, __newValue);
            }
            break;

            case "Module":
            {
                var __oldValue = (Zetbox.App.Base.ModuleNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Module);
                var __newValue = (Zetbox.App.Base.ModuleNHibernateImpl)parentObj;
                NotifyPropertyChanging("Module", __oldValue, __newValue);
                this.Proxy.Module = __newValue == null ? null : __newValue.Proxy;
                NotifyPropertyChanged("Module", __oldValue, __newValue);
            }
            break;

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