/// <summary>
        /// This code gets called on the first time this Object type is constructed
        /// </summary>
        void AddSharedBusinessRules()
        {
            lock (_LockObject) {
                if (!(SharedValidationRules.RulesExistFor(this.GetType())))
                {
                    ValidationRulesManager      mgrValidation      = SharedValidationRules.GetManager(this.GetType());
                    CharacterCasingRulesManager mgrCharacterCasing = SharedCharacterCasingRules.GetManager(this.GetType());

                    foreach (PropertyInfo prop in this.GetType().GetProperties())
                    {
                        foreach (BaseValidatorAttribute atr in prop.GetCustomAttributes(typeof(BaseValidatorAttribute), false))
                        {
                            mgrValidation.AddRule(atr.Create(prop.Name), prop.Name);
                        }

                        foreach (CharacterCasingFormattingAttribute atr in prop.GetCustomAttributes(typeof(CharacterCasingFormattingAttribute), false))
                        {
                            mgrCharacterCasing.AddRule(prop.Name, atr.CharacterCasing);
                        }
                    }

                    AddSharedBusinessValidationRules(mgrValidation);
                    AddSharedCharacterCasingFormattingRules(mgrCharacterCasing);
                }
            }
        }
        /// <summary>
        /// Called by in business entity sub-classes in their property setters to set the value of the property.
        /// If the business Object is not in a loading state, this method performs validation on the property
        /// <example>Example:
        /// <code>
        ///   Set(ByVal Value As String)
        ///       MyBase.SetPropertyValue("SL_DatabaseConnection", _strSL_DatabaseConnection, Value)
        ///   End Set
        /// </code>
        /// </example>
        /// </summary>
        /// <param name="propertyName">Property Name</param>
        /// <param name="currentValue">Current property value</param>
        /// <param name="newValue">New property value</param>
        protected void SetPropertyValue(String propertyName, ref String currentValue, String newValue)
        {
            if (currentValue == null)
            {
                if (newValue == null)
                {
                    return;
                }
            }
            else if (newValue != null && currentValue.Equals(newValue))
            {
                return;
            }

            if (!this.IsLoading)
            {
                _hasBeenValidated = false;
                _isDirty          = true;
                this.BeforePropertyChanged(propertyName);

                //only apply character casing rules after the Object is loaded.
                CharacterCasing characterCasing = SharedCharacterCasingRules.GetManager(this.GetType()).GetRuleForProperty(propertyName);

                currentValue = characterCasing != CharacterCasing.None ? FormatText.ApplyCharacterCasing(newValue, characterCasing) : newValue;

                CheckRulesForProperty(propertyName);
                InternalRaisePropertyChanged(propertyName);
                InternalRaisePropertyChanged(_STRING_ISDIRTY);
                InternalRaisePropertyChanged(_STRING_HASBEENVALIDATED);
                InternalRaisePropertyChanged(_STRING_ERROR);
                InternalRaisePropertyChanged(_STRING_HASERRORS);
                InternalRaisePropertyChanged(_STRING_HASNOERRORS);

                if (this.ThrowExceptionFromPropertySetters)
                {
                    String error = this[propertyName];

                    if (!(String.IsNullOrEmpty(error)))
                    {
                        throw new Exception(error);
                    }
                }

                this.AfterPropertyChanged(propertyName);
            }
            else
            {
                //since we are loading, just set the value
                currentValue = newValue;
            }
        }