Exemplo n.º 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)
            {
                ChangedByImpl = (Zetbox.App.Base.IdentityMemoryImpl)Context.Find <Zetbox.App.Base.Identity>(_fk_ChangedBy.Value);
            }
            else
            {
                ChangedByImpl = null;
            }

            if (_fk_CreatedBy.HasValue)
            {
                CreatedByImpl = (Zetbox.App.Base.IdentityMemoryImpl)Context.Find <Zetbox.App.Base.Identity>(_fk_CreatedBy.Value);
            }
            else
            {
                CreatedByImpl = null;
            }

            if (_fk_guid_Module.HasValue)
            {
                ModuleImpl = (Zetbox.App.Base.ModuleMemoryImpl)Context.FindPersistenceObject <Zetbox.App.Base.Module>(_fk_guid_Module.Value);
            }
            else
            if (_fk_Module.HasValue)
            {
                ModuleImpl = (Zetbox.App.Base.ModuleMemoryImpl)Context.Find <Zetbox.App.Base.Module>(_fk_Module.Value);
            }
            else
            {
                ModuleImpl = null;
            }
        }
        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)
                ChangedByImpl = (Zetbox.App.Base.IdentityMemoryImpl)Context.Find<Zetbox.App.Base.Identity>(_fk_ChangedBy.Value);
            else
                ChangedByImpl = null;

            if (_fk_CreatedBy.HasValue)
                CreatedByImpl = (Zetbox.App.Base.IdentityMemoryImpl)Context.Find<Zetbox.App.Base.Identity>(_fk_CreatedBy.Value);
            else
                CreatedByImpl = null;

            if (_fk_guid_Module.HasValue)
                ModuleImpl = (Zetbox.App.Base.ModuleMemoryImpl)Context.FindPersistenceObject<Zetbox.App.Base.Module>(_fk_guid_Module.Value);
            else
            if (_fk_Module.HasValue)
                ModuleImpl = (Zetbox.App.Base.ModuleMemoryImpl)Context.Find<Zetbox.App.Base.Module>(_fk_Module.Value);
            else
                ModuleImpl = null;
        }