/// <summary> /// Initializes a new instance of the <see cref="Editable<TWrappedObject>"/> class. /// </summary> /// <param name="current">The current.</param> public Editable(TWrappedObject current) { _changedProperties = new Dictionary <PropertyInfo, object>(); _current = current; _metaData = TypeMetaDataRepository.GetFor(GetType(), typeof(TWrappedObject)); _reset = new EditableCommand(ignored => UndoChanges(), ignored => true); }
/// <summary> /// Initializes a new instance of the DesignTimeTypeDescriptor class. /// </summary> /// <param name="objectType">Type of the object.</param> public EditableTypeDescriptor(Type objectType) { var wrapperObjectType = objectType; var wrappedObjectType = objectType; var baseType = wrapperObjectType.BaseType; while (baseType != null && baseType != typeof(object)) { if (baseType.Name == typeof(EditableAdapter <>).Name && baseType.GetGenericArguments().Length > 0) { wrappedObjectType = baseType.GetGenericArguments()[0]; break; } baseType = baseType.BaseType; } _context = TypeMetaDataRepository.GetFor(wrapperObjectType, wrappedObjectType); }
/// <summary> /// Initializes a new instance of the <see cref="EditableAdapter<TWrappedObject>"/> class. /// </summary> /// <param name="current">The object being wrapped.</param> public EditableAdapter(TWrappedObject current) { _changedProperties = new Dictionary <PropertyInfo, object>(); _current = current; _metaData = TypeMetaDataRepository.GetFor(this.GetType(), typeof(TWrappedObject)); }