How should I work with SQL Timestamps in a WebForms / Linq To SQL project?
I have a WebForms project where we are using Linq to SQL (L2S) to provide data access. I know L2S can handle timestamps, but what I'm wondering is, what i开发者_如何学JAVAs the best way to handle timestamps at the client side.
I'm thinking that one possibility is to simply put the timestamp into a hidden field when an entity is rendered, but this feels a bit hacky, another option would be to put the timestamp / whole object into a session variable, but again this doesn't feel very clean.
What alternatives are there?
It depends on whether you're talking lists of DTOs, or a single DTO.
For single DTOs, I'd put the timestamp and the ID into the viewstate.
For lists, I'd put hidden fields inside whatever list mechanic you prefer (gridview / repeater / manually building tables (yuk!)).
精彩评论