コード例 #1
0
 protected override object GetDataToSerialize(PropertyChangeTrackingObject outerObject)
 {
     return(new PropertyChangeTrackingObject.EntitySerializationData
     {
         ChangedProperties = outerObject.propertyBag,
         OriginalTypeName = outerObject.GetType().FullName,
         OriginalTypeAssembly = outerObject.GetType().Assembly.FullName
     });
 }
コード例 #2
0
 protected override object GetDataToSerialize(PropertyChangeTrackingObject outerObject)
 {
     PropertyChangeTrackingObject.EntityLoggingData result = null;
     if (outerObject.loggableProperties.Count > 0)
     {
         result = new PropertyChangeTrackingObject.EntityLoggingData
         {
             Properties = outerObject.loggableProperties
         };
     }
     return(result);
 }
コード例 #3
0
            public object GetObjectToSerialize(object obj, Type targetType)
            {
                PropertyChangeTrackingObject propertyChangeTrackingObject = obj as PropertyChangeTrackingObject;

                if (propertyChangeTrackingObject != null)
                {
                    return(this.GetDataToSerialize(propertyChangeTrackingObject));
                }
                if (obj is ExDateTime)
                {
                    return(new PropertyChangeTrackingObject.SerializableExDateTime((ExDateTime)obj));
                }
                return(obj);
            }
コード例 #4
0
 public override object GetDeserializedObject(object obj, Type targetType)
 {
     PropertyChangeTrackingObject.EntitySerializationData entitySerializationData = obj as PropertyChangeTrackingObject.EntitySerializationData;
     if (entitySerializationData != null)
     {
         string originalTypeName = entitySerializationData.OriginalTypeName;
         Type   type             = Type.GetType(originalTypeName, false);
         if (type == null)
         {
             string   originalTypeAssembly = entitySerializationData.OriginalTypeAssembly;
             Assembly assembly             = Assembly.Load(originalTypeAssembly);
             type = assembly.GetType(originalTypeName);
         }
         if (type == null)
         {
             throw new CorruptDataException(Strings.ErrorUnknownType(originalTypeName));
         }
         Type typeFromHandle = typeof(PropertyChangeTrackingObject);
         if (!typeFromHandle.IsAssignableFrom(type))
         {
             throw new CorruptDataException(Strings.ErrorNonEntityType(originalTypeName, typeFromHandle.Name));
         }
         try
         {
             PropertyChangeTrackingObject propertyChangeTrackingObject = (PropertyChangeTrackingObject)Activator.CreateInstance(type);
             propertyChangeTrackingObject.propertyBag = ((PropertyChangeTrackingObject.EntitySerializationData)obj).ChangedProperties;
             return(propertyChangeTrackingObject);
         }
         catch (MissingMethodException)
         {
             throw new CorruptDataException(Strings.ErrorNoDefaultConstructor(originalTypeName));
         }
     }
     PropertyChangeTrackingObject.SerializableExDateTime serializableExDateTime = obj as PropertyChangeTrackingObject.SerializableExDateTime;
     if (serializableExDateTime != null)
     {
         return(serializableExDateTime.ToExDateTime());
     }
     return(obj);
 }
コード例 #5
0
 protected abstract object GetDataToSerialize(PropertyChangeTrackingObject outerObject);