Exemple #1
0
        public void accessImpl(DustAccessCommand op, DustInfoTray tray)
        {
            var session = getCurrentSession();

            DustDataEntity ei = (tray.entity is DustContext)
                                ? session.ctx[((DustContext)tray.entity)]
                                : (DustDataEntity)tray.entity;

            var eKey = tray.key as DustDataEntity;

            if (null == eKey)
            {
                var key = tray.key as DustKey;
                if (null != key)
                {
                    eKey = modules[key.module][key.key];
                }
            }

            switch (op)
            {
            case DustAccessCommand.read:
                tray.value = ei.getValue(eKey, tray.value, tray.dustHint);

                if ((null == tray.value) && DustUtils.isEnumRef(eKey.optValType))
                {
                    foreach (DustProcCursor drc in rootSession.cursors)
                    {
                        if ((drc.owner == ei) && (drc.key == eKey))
                        {
                            tray.value = drc.Current.eTarget;
                            return;
                        }
                    }
                }

                break;

            case DustAccessCommand.write:
                tray.value = ei.setValue(eKey, tray.value, tray.dustHint);
                break;

            case DustAccessCommand.visit:
                var vp = new DustProcVisitProcess(session, tray);
                var vt = tray as DustVisitTray;

                if (null == vt)
                {
                    vp.visitRef(ei, eKey, null, true);
                }
                else
                {
                    vp.visitEntity(null);
                }
                break;
            }
        }
Exemple #2
0
 public static void access(DustAccessCommand op, DustInfoTray tray)
 {
     dustImpl.accessImpl(op, tray);
 }