Does ReadOnlyBase really need functions for Update, Delete, and Create?

Does ReadOnlyBase really need functions for Update, Delete, and Create?

Old forum URL: forums.lhotka.net/forums/t/1193.aspx


BBM posted on Tuesday, September 12, 2006

Hi everyone,

Why does ReadOnlyBase have functions defined for Update, Delete, and Create.  Even if all they do is throw exceptions, why have them at all in a read only class?  I thought that it might be to implement an some DataPortal interface, but I can comment out any or all of these functions and the compiler doesn't complain.

Just curious.

BBM

 

RockfordLhotka replied on Tuesday, September 12, 2006

Technically they are not required. Data portal would throw a method not found exception if they were removed and someone decided to try and call DataPortal.Update() on a ROB-derived object.

The reason they are there is to offer a nicer (?) exception message than method not found. Not all that important really, but having them in the code doesn't harm anything either, so I thought it was a decent trade-off.

Copyright (c) Marimer LLC