LINQ to SQL auto-generated extensibility methods
When I create entity classes using LINQ to SQL, I get what I want, but I also get many other extensibility method definitions.
For example for myField (TEXT) I get:
partial void OnMyFieldChanging(string value);
partial void OnMyFieldChanged();
What's the general use for the extensibility methods above?
0
source to share
1 answer
Most of the examples I've seen for overriding these methods use validation.
partial void OnMyFieldChanging(string value)
{
if(value == valid)
continue;
else
throw new Exception();
}
You can override these methods directly for each property or also override OnValidate () for the whole object
+2
source to share