Quote:
Originally Posted by tdewey
What am I missing? Must all methods in SqlArticlesProvider be public overrides of an abstracted class defined in ArticlesProvider?
Tom
|
Essentially, yes. The Liskov Substitution Principle again.
This is because the application is written to be able to work against any provider that implements ArticlesProvider.
The actual concrete provider implementation is determined by using reflection at runtime. The actual inside nuts and bolts of any particular concrete provider does not matter to the methods that call it. Because they all implement ArticlesProvider, the caller knows that the abstract methods and properties of ArticlesProvider are
guaranteed to be available.
SiteProvider.Articles is of type ArticlesProvider, so if you program against SiteProvider.Articles, it can only "see" the members defined in ArticlesProvider.
If any new methods are "exclusive" to a class, and not first defined as abstract in ArticlesProvider, then there is no way that Intellisense can know about them.