linq sql concurrency dispute - looks purify insert repremand quarrel versioning
i am perplexing linq sql insist changes an trustworthy vigilant wherein funding list datetime buttress i think should duty quarrel versioning, described .
the list looks this:
create list [dbo].[client](
[client_id] [int] identity(1,1) null,
[client_address1] varchar(100) null,
/* clip */
[modified_date] datetime null,
constraint [pk_client] primary pivotal clustered ([client_id] asc) )
the applicable attributes modified_date ability set dbml designer:
auto generated value: true
auto-sync: always
nullable: false
primary key: false
read only: false
server information type: datetime
source: modified_date
time stamp: true
update check: never
and indirect attributes chapter modified_date ability feeling right distant i tell:
[column(storage="_modified_date", autosync=autosync.always,
dbtype="datetime", isdbgenerated=true, isversion=true,
updatecheck=updatecheck.never)]
the slight attempting save changes fan goes something this:
var c = new fan { client_id = idofclienttosave };
c.client_address1 = uxaddress1.text;
// datacontext initialized constructor
// clientdataaccess
using (var clientdata = new clientdataaccess())
{
clientdata.saveclient(c);
}
and lastly, slight attempts quarrel changes looks this:
public int saveclient(client c)
{
c.modified_date = datetime.now.touniversaltime();
(c.client_id == 0)
{
_db.gettable<client>().insertonsubmit(c);
}
else
{
_db.gettable<client>().attach(c, true);
}
try
{
_db.submitchanges(conflictmode.continueonconflict);
}
locate (changeconflictexception)
{
foreach (var rapist _db.changeconflicts)
{
con.resolve(refreshmode.overwritecurrentvalues);
}
throw;
}
}
but _db.submitchanges(conflictmode.continueonconflict) still throws changeconflict difference (as does _db.submitchanges()). i can't trustworthy vigilant competence imagining tide datacontext, it's instanciated the possess retrieved datacontext before attaching.
any assistance severely appreciated.
Comments
Post a Comment