internal void InitializeDefaultValues() { ComplexType.DataProperties.ForEach(dp => { try { if (dp.IsComplexProperty) { SetDpValue(dp, ComplexAspect.Create(this.ComplexObject, dp)); } else if (dp.DefaultValue != null) { SetDpValue(dp, dp.DefaultValue); } } catch (Exception e) { Debug.WriteLine("Exception caught during initialization of {0}.{1}: {2}", this.ComplexObject.GetType().Name, dp.Name, e.Message); } }); }
internal void AbsorbCurrentValues(ComplexAspect sourceAspect) { this.ComplexType.DataProperties.ForEach(p => { var sourceValue = sourceAspect.GetValue(p); if (p.IsComplexProperty) { var targetChildCo = GetValue <IComplexObject>(p); var targetChildAspect = targetChildCo.ComplexAspect; var sourceChildAspect = ((IComplexObject)sourceValue).ComplexAspect; targetChildAspect.AbsorbCurrentValues(sourceChildAspect); } else { SetDpValue(p, sourceValue); } }); }
protected T GetValue <T>([CallerMemberName] string propertyName = "") { return(ComplexAspect.GetValue <T>(propertyName)); }
protected void SetValue(Object value, [CallerMemberName] string propertyName = "") { ComplexAspect.SetValue(propertyName, value); }
/// <summary> /// Protected ctor. /// </summary> protected BaseComplexObject() { ComplexAspect = new ComplexAspect(this, null); }