protected virtual TResult GetResultOfEntity() { var entity = _entity(); if (entity == null) { return(default(TResult)); } return((TResult)ReflexionEx.GetPropertyValue(entity, _result)); }
/// <summary> /// Set value to the property of the bounded entity /// </summary> /// <param name="value">New value</param> protected virtual void BindValueToProperty(TResult value) { if (InternalSet) { return; } var entity = _entity(); // if validators will permit if (entity != null && (Validators?.All(v => v.IsValid(value)) ?? true)) { ReflexionEx.SetPropertyValue(entity, value, _result); if (OnChanged != null) { var property = ReflexionEx.GetPropertyInfo(_result); var args = new BinderValueChangedArgs <TResult>(value, property.Name); OnChanged?.Invoke(this, args); } } }