4

I made a class from Linq to SQL Clasees with VS 2008 SP1 Framework 3.5 SP1, in this case I extended the partial

partial void UpdateMyTable(MyTable instance){
   // Business logic
   // Validation rules, etc.
}

My problem is when I execute db.SubmitChanges(), it executes UpdateMyTable and makes the validations but it doesn't update, I get this error:

[Exception: Deliver]
   System.Data.Linq.ChangeProcessor.SendOnValidate(MetaType type, TrackedObject item, ChangeAction changeAction) +197
   System.Data.Linq.ChangeProcessor.ValidateAll(IEnumerable`1 list) +255
   System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) +76
   System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) +331
   System.Data.Linq.DataContext.SubmitChanges() +19
Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
MrByte
  • 313
  • 1
  • 3
  • 9
  • 7
    Actually there is a policy on non-English questions: http://blog.stackoverflow.com/2009/07/non-english-question-policy/ – Graeme Perrow Oct 06 '09 at 16:10

2 Answers2

3
  • if you provide this method, you must perform the update in the method.

http://msdn.microsoft.com/en-us/library/bb882671.aspx

  • If you implement the Insert, Update and Delete methods in your partial class, the LINQ to SQL runtime will call them instead of its own default methods when SubmitChanges is called.

Try MiTabla.OnValidate

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
Amy B
  • 108,202
  • 21
  • 135
  • 185
1

If you want to implement this method but not do the update yourself you make the method call ExecuteDynamicUpdate(item);

Likewise ExecuteDynamicDelete and ExecuteDynamicInsert for DeleteMyTable and InsertMyTable respectively.

DamienG
  • 6,575
  • 27
  • 43