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);
         }
     });
 }
示例#3
0
 protected T GetValue <T>([CallerMemberName] string propertyName = "")
 {
     return(ComplexAspect.GetValue <T>(propertyName));
 }
示例#4
0
 protected void SetValue(Object value, [CallerMemberName] string propertyName = "")
 {
     ComplexAspect.SetValue(propertyName, value);
 }
示例#5
0
 /// <summary>
 /// Protected ctor.
 /// </summary>
 protected BaseComplexObject()
 {
     ComplexAspect = new ComplexAspect(this, null);
 }