protected Object GetOriginalValue(DataProperty property)
        {
            object result;

            if (property.IsComplexProperty)
            {
                var co = (IComplexObject)GetValue(property, EntityVersion.Current);
                return(co.ComplexAspect.GetOriginalVersion());
            }
            else
            {
                if (_originalValuesMap != null && _originalValuesMap.TryGetValue(property.Name, out result))
                {
                    return(result);
                }
                else
                {
                    return(GetValue(property));
                }
            }
        }
Beispiel #2
0
        private static DataProperty CreateDataProperty(StructuralType structuralType, PropertyInfo pInfo)
        {
            var propType = pInfo.PropertyType;
            var dp       = new DataProperty(pInfo.Name);

            // TODO: handle isScalar
            if (typeof(IComplexObject).IsAssignableFrom(propType))
            {
                dp.ComplexType = GetComplexType(propType);
                dp.IsNullable  = false;
                // complex Objects do not have defaultValues currently
            }
            else
            {
                dp.ClrType      = propType;
                dp.DataType     = DataType.FromClrType(TypeFns.GetNonNullableType(propType));
                dp.IsNullable   = TypeFns.IsNullableType(propType);
                dp.DefaultValue = dp.IsNullable ? null : dp.DataType.DefaultValue;
            }

            structuralType.AddDataProperty(dp);
            return(dp);
        }
 protected void UpdateBackupVersion(DataProperty property, Object oldValue)
 {
     // We actually do want to track Proposed changes when Detached ( or Added) but we do not track an Original for either
     if (this.EntityState.IsAdded() || this.EntityState.IsDetached())
     {
         if (this.EntityVersion == EntityVersion.Proposed)
         {
             BackupProposedValueIfNeeded(property, oldValue);
         }
     }
     else
     {
         if (this.EntityVersion == EntityVersion.Current)
         {
             BackupOriginalValueIfNeeded(property, oldValue);
         }
         else if (this.EntityVersion == EntityVersion.Proposed)
         {
             // need to do both
             BackupOriginalValueIfNeeded(property, oldValue);
             BackupProposedValueIfNeeded(property, oldValue);
         }
     }
 }
 private void SetDpValueSimple(DataProperty property, object newValue, object oldValue)
 {
     // Actually set the value;
     SetRawValue(property.Name, newValue);
     UpdateBackupVersion(property, oldValue);
 }
Beispiel #5
0
 /// <summary>
 /// Creates a new instance of UniqueId.
 /// </summary>
 /// <param name="property"></param>
 /// <param name="value"></param>
 public UniqueId(DataProperty property, Object value)
 {
     Property = property;
     Value    = value;
 }
Beispiel #6
0
 // not the same as the others above.
 internal void UpdateInverseForeignKeyProperties(DataProperty dp)
 {
     UpdateCollection(_inverseForeignKeyProperties, dp, true);
 }
Beispiel #7
0
 internal void UpdateForeignKeyProperties(DataProperty dp)
 {
     UpdateCollection(_foreignKeyProperties, dp, dp.IsForeignKey);
 }
Beispiel #8
0
 internal void UpdateConcurrencyProperties(DataProperty dp)
 {
     UpdateCollection(_concurrencyProperties, dp, dp.ConcurrencyMode == ConcurrencyMode.Fixed);
 }
Beispiel #9
0
 internal void UpdateKeyProperties(DataProperty dp)
 {
     UpdateCollection(_keyProperties, dp, dp.IsPartOfKey);
 }
Beispiel #10
0
 internal void UpdateUnmappedProperties(DataProperty dp)
 {
     UpdateCollection(_unmappedProperties, dp, dp.IsUnmapped);
 }
Beispiel #11
0
 internal void UpdateComplexProperties(DataProperty dp)
 {
     UpdateCollection(_complexProperties, dp, dp.IsComplexProperty);
 }
 internal DataPropertyBuilder(DataProperty dp)
 {
     DataProperty = dp;
 }
 internal virtual void OnDataPropertyRestore(DataProperty dp)
 {
     // deliberate noop here;
 }
 protected internal abstract void SetDpValue(DataProperty dp, object newValue);