Search code examples
c#asp.netarchitecturesoftware-design3-tier

3 Tier Architecture - data tier just stores data only?


Does the data tier verify any of the user's input? or does it just store data?

Example - User adds email to his profile.

Is this right?

Presentation Tier - Verify Email format is valid (client side)

Logic tier

  • Verify Email format is valid (again?)
  • Set Email type (ie is Primary email?)
  • Check record limit allowed to store email

Data:

  • Store the email record

Logic:

  • Send Notification to presentation tier
  • Send Notification via Email

Solution

  • Note :

    Data layer task is to connect with the database and to perform CRUD operation if you want to apply extra validation logic than you must do it in the logical layer

    You architecture changes

    Presentation Tier -

    • Verify Email format is valid (client side)

    Logic tier

    • Verify Email format is valid (again?) - No need to do it again
    • Set Email type (ie is Primary email?)
    • Check record limit allowed to store email

    Data Layer:

    • allow to connect with the database
    • perform CRUD operation

    Data Store i.e DataBase

    • Store the email record

    Return

    DataLyer

    • Informs logic layer data inserted propertly

    Logic Layer:

    • Send Notification to presentation tier either data inserted/updated properly
    • Send Notification via Email if Data Inserted/Updated properly else log error