asp.net mvc - Linq to SQL Data Concurrency - Is it safe to use only PKs? -


i getting error in mvc-based website surrounding data concurrency in linq sql:

"row not found or changed"

after reading several posts on here seems though accepted solution set non-primary key fields updatecheck = false in dbml designer. before taking plunge this, wanted ask, losing if this?

to honest, seems me should case, using primary key should fastest way find record anyway. assuming don't have composite pks. i'm not terribly familiar data concurrency scenarios, missing here?

thanks time!

[edit]

thanks feedback guys! give more detail, specific scenario have this:

i have article table number of fields (title, content, author, etc.). 1 of fields gets updated (anytime views article), popularity field, gets incremented every click. saw original error mentioned above when updated article text in database. navigated article on live site (which attempted update popularity field).

for starters sounds need not using shared datacontext. beyond that, maybe setting fields updatecheck never. being said, i not want article popularity not update due concurrency issue. being case, there way me ensure optimistic concurrency?

thanks again!!

i change updatecheck never on primary key(s) on entity classes in designer myself. lose notification of interim changes data since loaded it; end "last change wins" type of scenario. if ok in situation, then... fine.

there situations not thing do. instance, checking/adjusting bank account funds balance... or situation alternation field going based on calculation current value 1 of operands.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -