Пример #1
0
        private bool RaiseRecordFieldLoadError(object target, long index, string propName, ref object value, Exception ex)
        {
            bool   retValue = false;
            object state    = value;

            if (Reader != null && Reader.HasRecordFieldLoadErrorSubscribed)
            {
                retValue = ChoFuncEx.RunWithIgnoreError(() => Reader.RaiseRecordFieldLoadError(target, index, propName, ref state, ex), true);
                if (retValue)
                {
                    value = state;
                }
            }
            else if (target is IChoNotifyRecordFieldRead)
            {
                retValue = ChoFuncEx.RunWithIgnoreError(() => ((IChoNotifyRecordFieldRead)target).RecordFieldLoadError(target, index, propName, ref state, ex), true);
                if (retValue)
                {
                    value = state;
                }
            }
            else if (CallbackRecordFieldRead != null)
            {
                retValue = ChoFuncEx.RunWithIgnoreError(() => CallbackRecordFieldRead.RecordFieldLoadError(target, index, propName, ref state, ex), true);
                if (retValue)
                {
                    value = state;
                }
            }
            return(retValue);
        }
Пример #2
0
 private bool RaiseAfterRecordFieldLoad(object target, long index, string propName, object value)
 {
     if (Reader != null && Reader.HasAfterRecordFieldLoadSubscribed)
     {
         return(ChoFuncEx.RunWithIgnoreError(() => Reader.RaiseAfterRecordFieldLoad(target, index, propName, value), true));
     }
     else if (target is IChoNotifyRecordFieldRead)
     {
         return(ChoFuncEx.RunWithIgnoreError(() => ((IChoNotifyRecordFieldRead)target).AfterRecordFieldLoad(target, index, propName, value), true));
     }
     else if (CallbackRecordFieldRead != null)
     {
         return(ChoFuncEx.RunWithIgnoreError(() => CallbackRecordFieldRead.AfterRecordFieldLoad(target, index, propName, value), true));
     }
     return(true);
 }
Пример #3
0
        private bool RaiseBeforeRecordFieldLoad(object target, long index, string propName, ref object value)
        {
            if (Reader != null && Reader.HasBeforeRecordFieldLoadSubscribed)
            {
                object state    = value;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => Reader.RaiseBeforeRecordFieldLoad(target, index, propName, ref state), true);

                if (retValue)
                {
                    value = state;
                }

                return(retValue);
            }
            else if (target is IChoNotifyRecordFieldRead)
            {
                object state    = value;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => ((IChoNotifyRecordFieldRead)target).BeforeRecordFieldLoad(target, index, propName, ref state), true);

                if (retValue)
                {
                    value = state;
                }

                return(retValue);
            }
            else if (CallbackRecordFieldRead != null)
            {
                object state    = value;
                bool   retValue = ChoFuncEx.RunWithIgnoreError(() => CallbackRecordFieldRead.BeforeRecordFieldLoad(target, index, propName, ref state), true);

                if (retValue)
                {
                    value = state;
                }

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