Understanding Class Persistence
topic What is a class persistence?
issue I have been hearing about persisting classes. What does that mean?
version VB6

Persisting a class simply refers to saving the properties of that class. In VB, this means to write the properties into the PropertyBag and then store the PropertyBag in a file or in a database.

topic I cannot seem to make my object persist itself
issue I have been using the techniques for object persistence in the object's class. But it does not seem to work.
version VB6

That's right. An object cannot persist or depersist itself. Just like an object cannot create itself.

When an object's properties are stored in the PropertyBag, VB also writes the class ID of the object into the PropertyBag. When the object is depersisted, VB retrieves the class ID from the PropertyBag, creates the object, and then allows you to assign the properties of the object to values from the PropertyBag.

So the follow-on question here is what should cause the object to persist itself. When doing simple applications, you can have the form do this - but that is not very encapsulated. Another way to do this is to create an Application class that is responsible for persisting all of the objects in the application.

topic I cannot seem to persist my array properties
issue The persistence seems to work, but it generates an error any time I add an array property.
version VB6

That's right. Array properties cannot be persisted.

All contents © 2004 InStep Technologies, Inc. All rights reserved.