コード例 #1
0
        private bool RaiseBeforeRecordLoad(object target, ref Tuple <long, string> pair)
        {
            if (_callbackRecord != null)
            {
                long   index    = pair.Item1;
                object state    = pair.Item2;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => _callbackRecord.BeforeRecordLoad(target, index, ref state), true);

                if (retValue)
                {
                    pair = new Tuple <long, string>(index, state as string);
                }

                return(retValue);
            }
            else if (Reader != null)
            {
                long   index    = pair.Item1;
                object state    = pair.Item2;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => Reader.RaiseBeforeRecordLoad(target, index, ref state), true);

                if (retValue)
                {
                    pair = new Tuple <long, string>(index, state as string);
                }

                return(retValue);
            }
            return(true);
        }
コード例 #2
0
        private bool RaiseBeforeRecordLoad(object target, ref Tuple <long, IDictionary <string, object> > pair)
        {
            if (Reader != null && Reader.HasBeforeRecordLoadSubscribed)
            {
                long   index    = pair.Item1;
                object state    = pair.Item2;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => Reader.RaiseBeforeRecordLoad(target, index, ref state), true);

                if (retValue)
                {
                    pair = new Tuple <long, IDictionary <string, object> >(index, state as IDictionary <string, object>);
                }

                return(retValue);
            }
            else if (_callbackRecordRead != null)
            {
                long   index    = pair.Item1;
                object state    = pair.Item2;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => _callbackRecordRead.BeforeRecordLoad(target, index, ref state), true);

                if (retValue)
                {
                    pair = new Tuple <long, IDictionary <string, object> >(index, state as IDictionary <string, object>);
                }

                return(retValue);
            }
            return(true);
        }