Thursday, April 18, 2019

Database schema leaking into application logic

Apologies in advance since this isn't strictly C#/.NET specific, but that's the environment we're working in and this subreddit has delivered good responses in the past.

Our application is (partly) made up of a Business/Application layer where most of our business/application logic resides, and a Data Access layer where we make calls to our DB.

What we're experiencing now with our current design is that our database schema is leaking into our application logic in a sense. Our Model classes mirror the database tables exactly, and that includes a lot of data that's very much irrelevant inside our application.

We're using Dapper to map the results of our DB calls to c# objects, and using those objects as our Model. I'm looking for general information about design/architectural patters for these scenarios, as I imagine they are very common and standardized since this is such a common scenario.

I've been thinking about defining "Data Entity" classes inside the Data Access layer which would exactly match the database tables, and other Model classes which will be used for application logic. Then the Data Access layer would return the Data Access specific data classes back to the Application layer, which would map those objects to our Model classes.

I can give more specific examples of our code and/or architecture if needed. Any input appreciated thanks

Database schema leaking into application logic Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team