Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Don't you hate it when you do that?

Don't you hate it when you do that?

Scheduled Pinned Locked Moved The Weird and The Wonderful
announcementdatabasequestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #1

    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 have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    S 1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      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.

      S Offline
      S Offline
      Sentenryu
      wrote on last edited by
      #2

      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.'"

      OriginalGriffO B 2 Replies Last reply
      0
      • S Sentenryu

        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.'"

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        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.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        S 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          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.

          S Offline
          S Offline
          Sentenryu
          wrote on last edited by
          #4

          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.'"

          1 Reply Last reply
          0
          • S Sentenryu

            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.'"

            B Offline
            B Offline
            BobJanova
            wrote on last edited by
            #5

            Yeah that comes from somewhere quite deep in hell. When I want you to synchronise with an external data provider/sink, I'll tell you with a method call! I don't like entity mapping tools that are too clever for their own good.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups