I use Linq to SQL, which generates partial classes and partial methods. Then you extend this generated code, applying your settings manually in another partial class. One of the L2S hooks gives you the opportunity to implement partial methods called when a property changes. For example, if you have a property called "MyProp", you can implement a partial method as follows:
' Given to you in the generator Partial Private Sub OnMyPropChanged() End Sub ' Manually implemented in my custom class ' I cannot specify that this is an implementation of a Partial, even though it is... Private Sub OnMyPropChanged() Console.WriteLine("My prop changed... do something here") End Sub
The problem I ran into is that the name "MyProp" has now changed to "MyNewPropName", so now the partial generator creates Partial Private Sub OnMyNewPropNameChanged() , but my version of the partial method still has the old name. In fact, I now have an orphaned private method that is never called callable, which means my code is broken at runtime. How would you test something like this, or even better - is there a way to indicate that my version of OnMyPropChanged() is an implementation of the partial method, so that I get a trade-off time gap if there is no corresponding partial in the generated code?
source share