예제 #1
0
 internal static bool ContainsObjectError(object target)
 {
     lock (_weakDictionaryService.SyncRoot)
     {
         ChoConfigurationObjectErrorInfo errorInfo = GetConfigurationErrorInfo(target);
         return(errorInfo.ObjectMemberErrMsgs.Count != 0 || !errorInfo.ObjectErrMsg.IsNullOrEmpty());
     }
 }
예제 #2
0
        internal static void SetObjectError(object target, string errMsg)
        {
            ChoGuard.ArgumentNotNull(target, "Target");

            lock (_weakDictionaryService.SyncRoot)
            {
                ChoConfigurationObjectErrorInfo errorInfo = GetConfigurationErrorInfo(target);
                errorInfo.ObjectErrMsg = errMsg;
            }
        }
예제 #3
0
        internal static void ResetObjectMemberError(object target, string memberName)
        {
            ChoGuard.ArgumentNotNull(target, "Target");
            ChoGuard.ArgumentNotNullOrEmpty(memberName, "MemberName");

            lock (_weakDictionaryService.SyncRoot)
            {
                ChoConfigurationObjectErrorInfo errorInfo = GetConfigurationErrorInfo(target);
                errorInfo.ResetMemberErrorMsg(memberName);
            }
        }
예제 #4
0
        internal static void SetObjectMemberError(object target, string memberName, string errMsg)
        {
            ChoGuard.ArgumentNotNull(target, "Target");
            ChoGuard.ArgumentNotNullOrEmpty(memberName, "MemberName");

            lock (_weakDictionaryService.SyncRoot)
            {
                ChoConfigurationObjectErrorInfo errorInfo = GetConfigurationErrorInfo(target);
                errorInfo.SetMemberErrorMsg(memberName, errMsg.Replace(Environment.NewLine, " "));
            }
        }
예제 #5
0
        private static ChoConfigurationObjectErrorInfo GetConfigurationErrorInfo(object target)
        {
            ChoGuard.ArgumentNotNull(target, "Target");

            ChoConfigurationObjectErrorInfo errorInfo = _weakDictionaryService.GetValue(target);

            if (errorInfo == null)
            {
                errorInfo = new ChoConfigurationObjectErrorInfo();
                _weakDictionaryService.SetValue(target, errorInfo);
            }

            return(errorInfo);
        }