I need to write a data access layer using the Entity Framework. One of the requirements is to allow the configuration file to control where the data comes from. With one configuration setting, it should come from the database; on the other, from a web service.
Now, my initial thought is to have 3 DataAccess classes:
- WidgetDataAccess
- WidgetDatabaseDataAccess
- WidgetWebServiceDataAccess
All of them will implement the same interface. WidgetDataAccess will read the configuration and delegate the correct child class. That seems reasonable, right?
Is there any template I should follow, or anyone with a better way to structure this?
source share