internal static bool ContainsObjectError(object target) { lock (_weakDictionaryService.SyncRoot) { ChoConfigurationObjectErrorInfo errorInfo = GetConfigurationErrorInfo(target); return(errorInfo.ObjectMemberErrMsgs.Count != 0 || !errorInfo.ObjectErrMsg.IsNullOrEmpty()); } }
internal static void SetObjectError(object target, string errMsg) { ChoGuard.ArgumentNotNull(target, "Target"); lock (_weakDictionaryService.SyncRoot) { ChoConfigurationObjectErrorInfo errorInfo = GetConfigurationErrorInfo(target); errorInfo.ObjectErrMsg = errMsg; } }
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); } }
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, " ")); } }
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); }