/// <summary> /// Attempts to return the value of the property, but returns fallbackValue if the property value is not available /// </summary> /// <typeparam name="dryObj">Dry Object Type</typeparam> /// <typeparam name="T">Parameter Type</typeparam> /// <param name="dryObject">Dry Object</param> /// <param name="propertyPath">expression to the property</param> /// <param name="fallbackValue">value to return, if a typed value is not available</param> /// <returns>Property value or fallbackValue if not available</returns> public static T TryGetValue <dryObj, T>(dryObj dryObject, Expression <Func <dryObj, T> > propertyPath, T fallbackValue) { var propertyValue = ObjectInstance.GetObjectInstance(dryObject).PropertyValues[GetPropertyName(propertyPath)]; if (propertyValue.TypedValueIsAvailable) { return((T)propertyValue.Value); } return(fallbackValue); }
public DryLogicProxy(Object objectToProxy) { this.proxiedObject = objectToProxy; dynamic dynamicObject = objectToProxy; PropertyInfo prop = objectToProxy.GetType().GetProperty("OI", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); this.objectInstance = ObjectInstance.GetObjectInstance(objectToProxy, true); //this.domainObject = dynamicObject.DomainContainer; //if the parent object implements INotifyPropertyChanged... if (this.proxiedObject is INotifyPropertyChanged) { //then wire it up ((INotifyPropertyChanged)proxiedObject).PropertyChanged += new PropertyChangedEventHandler(Object_PropertyChanged); } else //parent does not implement INotify... { //wire up the domain object instead this.objectInstance.PropertyChanged += new PropertyChangedEventHandler(Object_PropertyChanged); } }
public Boolean Validate(T dryObject, out List <RuleViolation> ruleViolations) { var oi = ObjectInstance.GetObjectInstance(dryObject); return(this.Validate(oi, out ruleViolations)); }
//not sure if this should be here...oi already has validate methods that point back to the object definition...redundant public Boolean Validate(T dryObject) { var oi = ObjectInstance.GetObjectInstance(dryObject); return(this.Validate(oi)); }