views:

34

answers:

2

Hi,

Is there a way (meta property maybe) to tell db4o to simply ignore a specific property of a class?

I can't see anywhere to do that..

For my purpose I have a bunch of data entity that i need to persist now and then. I also sometimes need to hold a ref to a UI element associated with it, but I don't want db4o to persist that element when I update the object.

I can go around it by backing up, nulling the ref, saving, and finally restoring the reference but it seems really bad.

Anyway I can tell db4o to ignore it altogether?

A: 

Its actually right there in the doco, you just need the right search term :-)

Look in the docs for Transient Fields / Classes.

Tim Jarvis
thanks for your answer too
Ben
+2  A: 

Hi

You can add the Transient attribute to the specific field (db4o knowns nothing about properties)

public class Test
{
    [Transient] private string name;
    // ...
}

Best

Vagaus
ah yes, couldn't see while skimming through the doc.. odd name I guess
Ben
bonus point for the link
Ben
You can also use the NonSerialized attribute if you don't like the transient one. Anyway, for me the name "transient" makes sense.http://msdn.microsoft.com/en-us/library/system.nonserializedattribute.aspx
Vagaus