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