Don't you hate it when you do that?
-
I added a feature to one of my apps at the last revision which needed a new column in the DB. I thought the latest version was slower to start that it used to be, but dismissed it as my imagination - with a note to investigate moving the DB load into a background task when I was doing major mods. Until tonight... I just added another feature that needs another column and found that when I load the DB info, I was saving the DB value into the Property of the class, not the backing field. And yes, the property does Update the record back to the DB, in case you were wondering... :doh: So when I load my data, I not only read every record, but I immediately write it back as well... :-O Adding an "_" character made a huge difference! :laugh:
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre. Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
-
I added a feature to one of my apps at the last revision which needed a new column in the DB. I thought the latest version was slower to start that it used to be, but dismissed it as my imagination - with a note to investigate moving the DB load into a background task when I was doing major mods. Until tonight... I just added another feature that needs another column and found that when I load the DB info, I was saving the DB value into the Property of the class, not the backing field. And yes, the property does Update the record back to the DB, in case you were wondering... :doh: So when I load my data, I not only read every record, but I immediately write it back as well... :-O Adding an "_" character made a huge difference! :laugh:
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre. Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
Properties that write back to the database are hell. I've some here and i really hate them.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"
-
Properties that write back to the database are hell. I've some here and i really hate them.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"
They do make sense in some cases, because they prevent data loss if you forget to call the "Update" method after a user makes a change to the form. But they are a PITA sometimes, yes...
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre. Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
-
They do make sense in some cases, because they prevent data loss if you forget to call the "Update" method after a user makes a change to the form. But they are a PITA sometimes, yes...
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre. Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
OriginalGriff wrote:
because they prevent data loss if you forget to call the "Update" method after a user makes a change to the form
That also prevents Undo and Cancel functionality, and that's the sort of thing that should be picked up on tests. For me, properties should at most contain simple value validation, like accepted ranges and non-null enforcement, leaving other kinds of validation and persistency to methods. I've a technical level on mechanics, so the way i think is like a worker operating a lathe, when you set a property, you're positioning the metal part, when you call a method, you're actually turning the lathe on and working the metal.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"
-
Properties that write back to the database are hell. I've some here and i really hate them.
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"