views:

22

answers:

2

Hi, i need to set LINQ UpdateCheck attribute of columsn in every tables in mine db, is there any quick way to set all column's updatecheck attribute?

A: 

There's no such feature built into the L2S designer in Visual Studio, but you can either:

a) Add a timestamp/rowversion column to all tables; the timestamp column will then be used for concurrency checks instead of all columns. (...if the reason you want to do this is to simplify the SQL update statements...)

...or...

b) open the DBML file in an xml editor and do search/replace or other mass update.

...or...

c) try out my add-in for L2S ( you can download it and get a trial license from www.huagati.com/dbmltools ); one of the commands it adds to the L2S designer is a "mass update" for the updatecheck property:

alt text

alt text

KristoferA - Huagati.com
A: 

There's one way you could do this in code. If you iterate over each of the tables properties and obtain their ColumnAttributes, you can set each of their UpdateCheck properties to Never. This has to be done prior to the mapping source being created for the DataContext, though.

It's good for quickly testing something, but it's probably not the best idea for updating the ColumnAttributes on each of your properties.

rossisdead