How to: Make a Class or Property Non-Persistent
If you don’t want to store a property or a field that is persistent by default, you can explicitly mark it as non-persistent with the NonPersistentAttribute as shown in the following code example.
You can also make the entire class non-persistent. One common example is when you want to have your own base class (say, MyBusinessObject) for all persistent objects. By default, XPO will create a table MyBusinessObject where it will store a record for every business object in the system. To avoid this, mark MyBusinessObject as non-persistent as shown in the following code snippet.
[NonPersistent]
public class MyBusinessObject: XPObject {
}
public class Contact : MyBusinessObject {
}
Note
XPO cannot restore non-persistent class references even if the actual object instance referenced is persistent. In the example above, XPO will not be able to restore reference to My