Just got a comment from Mason Wheeler, that he prefers to use attributes to indicate a property to NOT serialise , rather than those properties to serialise. I quite like this idea, as it’s true that if you have quite a few properties to serialise, your class may get rather messy. My only problem with this is that the property name must then be the same as the column name. I guess not a major problem, but still. In a perfect world, you’d have two types of attributes. Those which came before properties, methods or fields and those which came after. Those which came before would work just like the class visibility sections. i.e. they apply to all properties, methods and fields until the next attribute, or section. Those attributes that came after a property, method or field, apply to that item only. thus I could write something like this.
property Id : Int64;[Key][ColName('Id')];
property FirstName : string read fname;[ColName('Name')];
property Surname : string read fSurname;
property Address : string read fAddress;
property FullName : string; //not persisted
I’m not sure how difficult that would have been to parse.