public void SetValue(object target, object value) { object currentModel = target; if (DependentAttribute.DependentOn != null) { var targetPath = DependentAttribute.DependentOn.Trim().Split('.'); foreach (var path in targetPath) { if (currentModel == null) { break; } currentModel = currentModel.GetType().GetProperty(path).GetValue(currentModel); } } var resolvedValue = APIUtils.InvokeMethod(DependentAttribute.Resolver, "Resolve", new object[] { DB, engineService, RequesterId, currentModel, DependentAttribute.DependentOn }); this.ValueProvider.SetValue(target, resolvedValue); }
public object GetValue(object target) { var resolvedValue = APIUtils.InvokeMethod(DependentAttribute.Resolver, "Resolve", new object[] { DB, engineService, RequesterId, DependentAttribute.DependentOn == null ? target : target.GetType().GetProperty(DependentAttribute.DependentOn).GetValue(target), DependentAttribute.DependentOn }); if (resolvedValue == null) { return(this.ValueProvider.GetValue(target)); } else { return(resolvedValue); } }