开发者

How should I work with SQL Timestamps in a WebForms / Linq To SQL project?

开发者 https://www.devze.com 2022-12-08 21:14 出处:网络
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 tim

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!)).

0

精彩评论

暂无评论...
验证码 换一张
取 消