Share via


IPersistPropertyBag2 interface

Works with the IPropertyBag2 interface and the IErrorlog interface to define an individual property-based persistence mechanism.

Members

The IPersistPropertyBag2 interface inherits from IPersist. IPersistPropertyBag2 also has these types of members:

  • Methods

Methods

The IPersistPropertyBag2 interface has these methods.

Method Description
InitNew

Informs the object that it is being initialized as a newly created object.

IsDirty

Indicates if one or more properties have changed since the last initialization or "Save" operation.

Load

Instructs the object to initialize itself by using the properties available in the property bag,and to notify the provided error log object when errors occur.

Save

Instructs the object to save its properties to the given property bag, and optionally, to clear the object's "dirty" flag.

 

Remarks

The IPersistPropertyBag2 interface is similar to the IPersistPropertyBag interface, but it allows the object to support property bags that implement IPropertyBag2.

A mechanism such as IPersistStream gives an object an IStream in which to store its binary data; IPersistPropertyBag2 provides an object with an IPropertyBag2 interface through which the object can save and load individual properties. The object that implements IPropertyBag2 can save those properties in various ways, such as name/value pairs in a text file. Errors encountered in the process (on either side) are recorded in an error log through IErrorlog. This error reporting mechanism works on a per-property basis, instead of on all properties at once.

A property bag that supports IPropertyBag2 attempts to get the object's IPersistPropertyBag2 interface before it attempts to get the object's IPersistPropertyBag interface. This allows objects that support either interface to communicate with the property bag.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Ocidl.h

IDL

Ocidl.idl