MarimerLLC / cslaforum

Discussion forum for CSLA .NET
https://cslanet.com
Other
31 stars 6 forks source link

provider pattern atlernatives for Data Access #381

Open Chicagoan2016 opened 7 years ago

Chicagoan2016 commented 7 years ago

We don't need a pluggable Data Access layer (at least for the time being), I was wondering if I should go ahead and create my Dataaccess.Sql project without the interface project? If I need Pluggable data access layer in the future would any of the dependency injection containers help (without changing existing code base)?

regards

rockfordlhotka commented 7 years ago

You can certainly do that, but it will tie the code in your DataPortal_XYZ methods to your DAL implementation.

So later, if you do want to switch to a provider or DI model you'll need to change your DataPortal_XYZ code to interact with that new model. But you shouldn't have to change any business logic, structure of your business domain model, or presentation layer code.

image

The whole point of the CSLA architecture, and the DataPortal_XYZ methods is to help ensure that if/when you need to change your DAL, the only changes to the rest of the code occur in the DataPortal_XYZ methods. Keep the changes isolated to the Data Access layer and avoid impacting other layers.

Chicagoan2016 commented 7 years ago

Thank you Rocky!