Last post Jul 11, 2010 09:46 AM by integrasol
Jul 11, 2010 04:06 AM|Answers|LINK
I am trying to add unique column validation to an Dynamic data web application , based on Entity model. (.edmx).
I tried to use the- partial void on_Changing(string value) event in my metaData class but this event raised when the page is first goes up.
(I put break point in the event and clicked on the relevent table, this event is raising).
My purpose is to avoid duplicate key violation.
anyone can help my how can I do it???
Jul 11, 2010 09:46 AM|integrasol|LINK
Well, if you have a partial class for the ObjectContext class, you can override the OnContextCreated method to add a handler for the SavingChanges event. Here is some sample VB code:
Partial Public Class xxxObjectContext
Private Sub OnContextCreated()
' Register handler for SavingChanges event
AddHandler Me.SavingChanges, AddressOf FixChanges