Andru's WebLog

//Comments about technology and software architecture

July 2005 - Posts

Retina.NET default persistent data on entities

Hi, currently Retina.NET defines as persistent public fields and public properties.
If you want to change that behavior you must use attributes. For example, to make a private field persistent you must add an attribute, the same is for making a public property non-persistent.

Well, I want to change that behavior and make only fields persistent by default.
The reason for doing this is that in general persistent data is something internal to the entity (it's state) and have nothing (or little) to do with the behavior of the entity.

One example of this is the use of properties for automatic databinding. Automatic databinding works only over properties and not fields, so we endup having a bunch of public properties with non-persistent attributes. I think that pattern is somewhat widely used and the extra attributes can ve better avoided.

Well, so we have fields for persistence and properties for behavior (databinding or something else), but there is the issue of waht accesibility should have those persistent fields.

Some friend of mine told me that all fields (public, private, etc) should be made persistent by default. Despite the fact that his idea have some sense, I don't like to make persistent by default all those private fields used for internal code (even the private fields exposed by our public properties), and I don't want to put non-persistent attributes over each private field I use.

I have thinked that maybe using protected fields as persistent by default should be a comprimising solution, but I'm not quite convinced.

Anyway, for build I'm making this option configurable by entity, but defining the correct default is an important step in making Retina.NET more useful to us all.

So, here I am, asking for your opinions....

What do you think Retina.NET must consider by default as persistent?

Your comments are welcome!


Posted: Jul 04 2005, 07:04 PM by andresv | with 3 comment(s)
Filed under: ,
More Posts