I have a class:
class BasePage
{
protected abstract Company ReferencedCompany
{
get;
}
}
And an asp.net page that inherits from it. However i do not want/need to implement this property in the inheriting class. And I dont really want to leave it blank. Is there a design pattern I can use to avoid this clear violation of the Interface Segregation Principle (ISP)?
Also I cant re-factor the entire code base so I was looking for something I could throw in the way. The adapter pattern perhaps?
You should have more types. If some page doesn’t have a
ReferencedCompanythen that page is not a BasePage. See an example below:If you use this with ASP.NET WebForms consider using MVP pattern, it cleanly separates view model and presenter.