e4rthdog
e4rthdog

Reputation: 5223

Using DataTable in UI layer instead of entities

My basic 3 layered application consists of a DAL that talks to my BLL and BLL interacts with UI..

Until now i was using the old fashioned way of building the DAL with datareaders and update/insert commands. This has worked well because most of my needs where to read.

Now i need more and more to update database info and check some basic concurrency. I am thinking of using datatables to make my UI more flexible in editing and persisting data in db tables.

Now i am having a List<InventoryItem> in my UI and whenever i need i am sending this list to BLL->DAL to make my changes.

In my mind i think that i will have to make my BLL return datatable to UI in order to make my UI easier to respond to updates?

My main issue is how to logically bind the 3 layer logic (UI-BLL-DAL) with the advantages of DataAdapter/DataSets/DataTables model...

Upvotes: 1

Views: 470

Answers (1)

daryal
daryal

Reputation: 14919

This seems proper at first, but doing it will simply destroy the layered architecture. With carrying typed datasets (datatable) up to UI, you are simply enabling the UI to use CRUD operations directly. Then there is no need to use other layers.

This will simply destroy the abstraction.

Use of an N-layer architecture is a choice, whether to use it or not depends on your requirements. Maybe, first you need to decide whether you really need it; and unless you can come up with a proper reasoning, you do not need to use it.

Upvotes: 1

Related Questions