/// <summary> /// Initializes a new instance of the <see cref="CommandifiedMember<TValue, TChangeType>"/> class. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="changeTypeValueToUse">The change type value to use.</param> /// <param name="loggedErrors">container for error messages. Can be null.</param> public CommandifiedMember(string memberName, TChangeType changeTypeValueToUse, ErrorContainer loggedErrors) : this(memberName, changeTypeValueToUse, loggedErrors, default(TValue)) { }
/// <summary> /// Initializes a new instance of the <see cref="CommandifiedMember<TValue, TChangeType>"/> class. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="changeTypeValueToUse">The change type value to use.</param> /// <param name="loggedErrors">The logged errors container.</param> /// <param name="initialValue">The initial value.</param> public CommandifiedMember(string memberName, TChangeType changeTypeValueToUse, ErrorContainer loggedErrors, TValue initialValue) { if (string.IsNullOrEmpty(memberName)) { throw new ArgumentException("memberName has to have a value"); } _loggedErrors = loggedErrors; _changeTypeValueToUse = changeTypeValueToUse; _memberName = memberName; _memberValue = initialValue; this.ThrowExceptionOnValidationError = true; BindToElementChanged(); BindToElementRemoved(); }
/// <summary> /// Initializes a new instance of the <see cref="CommandifiedMember<TValue, TChangeType>"/> class. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="changeTypeValueToUse">The change type value to use.</param> /// <param name="loggedErrors">The logged errors container.</param> /// <param name="initialValue">The initial value.</param> public CommandifiedMember(string memberName, TChangeType changeTypeValueToUse, ErrorContainer loggedErrors, TValue initialValue) { ArgumentVerifier.ShouldBeTrue((s) => !String.IsNullOrEmpty(memberName), memberName, "memberName has to have a value"); _loggedErrors = loggedErrors; _changeTypeValueToUse = changeTypeValueToUse; _memberName = memberName; _memberValue = initialValue; this.ThrowExceptionOnValidationError = true; _setValueDescription = "Set a new value to '" + _memberName + "'"; BindToElementChanged(); BindToElementRemoved(); }