Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's up with Concurrency and MM .NET (GetConflictData?
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01317518
Message ID:
01317663
Views:
29
>>Jeff,
>>
>>>I've read in the help under the section entitled "Handling Concurrency Errors" and I've created a Windows forms demonstration project using the employees table from the Pubs database and I'm getting strange results, indeed!
>>>
>>>The help in this section says:
>>>
>>>"To retrieve the current data in the database, the business object's GetConflictData method is called to return a DataRow containing the current values."
>>>
>>>However, when I run GetConflictData(this.employee.datarow) it ends up changing the values of the data in the backend. I did not run the form's Save method at all and my backend data got changed.
>>>
>>>Here's my simple program:
>>>
>>>private void mmButtonSave1_Click(object sender, EventArgs e)
>>>{
>>> DataSet myconflict = this.Employee.GetConflictData(this.Employee.DataRow);
>>> DataTable dt = myconflict.Tables[0];
>>> DataRow dr = dt.Rows[0];
>>> string fname = dr.ItemArray[1].ToString();
>>>}
>>>
>>>The value of fname is always the name from the form that I just changed it too. It's never what was current in that backend, which I changed in Query Analzyer to something entirely different.
>>>
>>>I don't understand how concurrency is supposed to work in MM .NET where the help says:
>>>
>>>********************************
>>>Changing Default Concurrency Handling Behavior
>>>
>>>There are a number of ways you can change the default MM .NET concurrency handling behavior:
>>>
>>>Override the business object's HandleException method, check for DBConcurrencyException, and perform completely different handling logic
>>>
>>>Override the business object's BuildConcurrencyExceptionMessage method to change how the exception message is built
>>>
>>>Override the business object's GetConflictData method to change the way conflicting concurrency data is retrieved from the database
>>>********************************
>>>
>>>Exactly, what is the default behavior? Right now all I see is that GetConflictData isn't doing what I would think it should do at all. It's changing the backend data. How can that be correct?
>>
>>Can you give me specifics on how the back end data is being changed?
>>
>>Best Regars,
>
>Kevin, like I said, the backend data is being changed when I call the BO's GetConflictData() method. And NOWHERE am I calling a SAVE() method of any kind. I mean, the data in SQL Server is being changed. If I change the value of the fname textbox in my Windows form and step over the code where it calls GetConflictData() method and then query the employee table via Query Analyzer or whatever it's SQL 2005 version is called I see the data changed in the table. See my code snippet above.
>
>Is GetConflictData() supposed to make updates to the SQL backend?
************************************
************************************
************************************
Kevin,

Here's some more data on this issue. I'm using VS2008, SQL Server 2000, and MM .NET 3.5.

Here's the trace from the SQL Profiler when I call GetConflictData():

exec sp_reset_connection
go
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;BEGIN TRANSACTION
go
exec dbo.employeeUpdate @emp_id = 'PSA89086M', @fname = 'Ferd', @hire_date = 'Nov 11 2008 12:00:00:000AM', @job_id = 14, @job_lvl = 89, @lname = 'Afonso', @minit = 'S', @pub_id = '1389'
go
COMMIT TRANSACTION
go
exec sp_reset_connection
go
SET FMTONLY OFF; SET NO_BROWSETABLE ON;
go
exec dbo.employeeSelectByPK @emp_id = 'PSA89086M'
go
SET NO_BROWSETABLE OFF;
go
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform