This website is intended as archive for old content and forums.
Please visit http://opf3.codeplex.com for the project's new website.

General Discussion

FORUM TOPIC

What is Opf3? Why is Opf3? How is Opf3? All these burning questions and issues discussed here.

RSS
Mike Challis
Posted on the 08/02/07 1:35 PM
Readonly column in database
Reply Quote
 I have a "created" column that holds the datetime the row was inserted.

I would like this value to be readonly in my object and for Opf3 not to attempt to update this value when writing back to the database.

Is there some kind of Readonly attribute that can be applied to say that this property should be read from the database, but never appear in any insert or update commands?

The value on this column will come from a default in the database or perhaps a trigger.

Thanks,

Mike

Christian Liensberger [Moderator]
Posted on the 08/02/07 2:47 PM
RE: Readonly column in database
Reply Quote
 You can use the PersistBehaviours property of the FieldAttribute:

PersistBehaviours = PersistBehaviours.DontInsert | PersistBehaviours.DontUpdate


This example would not insert nor update the property. On the other hand, if you want it only not to be updated use only the DontUpdate flag Smile

I hope this helps.

Christian

Mike Challis
Posted on the 08/02/07 3:57 PM
RE: Readonly column in database
Reply Quote
 Nice one!

Works a treat.

PS. I am looking at the Advanced Tutorial and it looks like it is a bit out of date. Is there a more comprehensive and updated set of tutorials available?

Christian Liensberger [Moderator]
Posted on the 08/02/07 5:19 PM
RE: Readonly column in database
Reply Quote
 Hi,

can you point me to what is out of date. I'm trying to keep this stuff up to date, although some things, like the Transactions stuff hasn't been updated, because the old way is still supported Smile

More on new stuff is found here: http://www.opf3.com/Opf3/Community/Default.aspx?Forum=5

All times are in GMT.