Application I develop requires several data sources (2 RDBMS and one file stora开发者_如何学JAVAge) to operate. I'm going to incapsulate datasources with DAL library & Business Logic layer.
Would you personally create several DAL libraries (each per data source) and cooperate several DAL instances in Business Logic Layer or create monolith DAL library, that incapsulates all datasources application uses?
It's difficult to tell without more information but if there are going to be a lot of methods for each data source I'd be inclined to create separate DALs.
It is then possible other applications (only interested in one of the data sources) could re-use one of the DALs - they won't have to deal with unrelated methods/data sources.
More importantly, make sure you inject your DAL into the business logic layer so you can test the business logic layer without actually using the "real" data source.
精彩评论