subsonic won’t update my bit field?

I recently ran into a really strange problem while using SubSonic.  I had a bit column in my database that was set to not allow nulls and had a default value of false.  Pretty standard stuff in the world of database design I guess.

When it came time to start saving my entities to the database, everything was working ok, except…. except after I had created a record in the database I could never change the IsActive column, like wtf?  I could never toggle between true and false on an existing record, but an insert would save the record perfectly every time.

To make a long incredibly frustrating story short, it turns out that if you have a bit field, that is set to allow nulls and has a default value of false it will never update (this is only using SubSonic).

So to ensure your bit fields work correctly in SubSonic, make sure those bit columns allow null and don’t have any default values!

This entry was posted in Code, SubSonic, programming, work. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>