/// <summary> /// Creates a new strongly typed scalar data which can be used as data binding source, from exising property or field . /// </summary> /// <typeparam name="T">The type of the scalar data.</typeparam> /// <param name="propertyOrFieldName">The name of the property or field.</param> /// <param name="equalityComparer">The equality comparer.</param> /// <returns>A new strongly typed scalar data which can be used as data binding source, from exising property or field.</returns> protected Scalar <T> NewLinkedScalar <T>(string propertyOrFieldName, IEqualityComparer <T> equalityComparer = null) { var getter = this.GetPropertyOrFieldGetter <T>(propertyOrFieldName); var setter = this.GetPropertyOrFieldSetter <T>(propertyOrFieldName); return(ScalarContainer.CreateNew(getter, setter, equalityComparer)); }
public LinkedScalar(ScalarContainer container, int ordinal, IEqualityComparer <T> equalityComparer, Func <T> getter, Action <T> setter) : base(container, ordinal, equalityComparer) { Debug.Assert(getter != null); Debug.Assert(setter != null); _getter = getter; _setter = setter; }
internal Scalar(ScalarContainer container, int ordinal, IEqualityComparer <T> equalityComparer) : base(container, ordinal) { if (equalityComparer == null) { equalityComparer = EqualityComparer <T> .Default; } _equalityComparer = equalityComparer; }
public EntityScalar(ScalarContainer container, int ordinal, IEqualityComparer <T> equalityComparer, T value) : base(container, ordinal, equalityComparer) { _value = value; if (IsEditing) { _editingValue = _value; } }
/// <summary> /// Initializes a new instance of <see cref="BasePresenter"/> class. /// </summary> protected BasePresenter() { _scalarContainer = new ScalarContainer(this); }
/// <summary> /// Creates a new strongly typed scalar data which can be used as data binding source, from existing getter and setter. /// </summary> /// <typeparam name="T">The type of the scalar data.</typeparam> /// <param name="getter">The exising getter of the scalar data.</param> /// <param name="setter">The existing setter of the scalar data.</param> /// <param name="equalityComparer">The equality comparer.</param> /// <returns>A new strongly typed scalar data which can be used as data binding source, from exising getter and setter.</returns> protected Scalar <T> NewLinkedScalar <T>(Func <T> getter, Action <T> setter, IEqualityComparer <T> equalityComparer = null) { getter.VerifyNotNull(nameof(getter)); setter.VerifyNotNull(nameof(setter)); return(ScalarContainer.CreateNew(getter, setter, equalityComparer)); }
/// <summary> /// Creates a new strongly typed scalar data which can be used as data binding source. /// </summary> /// <typeparam name="T">The type of the scalar data.</typeparam> /// <param name="value">The initial value of the scalar data.</param> /// <param name="equalityComparer">The equality comparer.</param> /// <returns>A new strongly typed scalar data which can be used as data binding source.</returns> protected Scalar <T> NewScalar <T>(T value = default(T), IEqualityComparer <T> equalityComparer = null) { return(ScalarContainer.CreateNew(value, equalityComparer)); }
internal static Scalar <T> Create(ScalarContainer container, int ordinal, IEqualityComparer <T> equalityComparer, Func <T> getter, Action <T> setter) { return(new LinkedScalar(container, ordinal, equalityComparer, getter, setter)); }
internal static Scalar <T> Create(ScalarContainer container, int ordinal, IEqualityComparer <T> equalityComparer, T value) { return(new EntityScalar(container, ordinal, equalityComparer, value)); }
internal Scalar(ScalarContainer container, int ordinal) { _container = container; _ordinal = ordinal; }