passing data through tiers

J

jogisarge

hello,

i try to develop a winform pgm in three tier architecture(UI,BAL,DAL).

short example:
I have a winform with a datagridview which shows products.
I want to change data in the grid.
there is a button (update) on the form.
By clicking this button, the changed data should be updated in the
database.


1. By starting the programm the products should be loaded by the BAL
from DAL.
and delivered to the Datagridview.
2. By clicking the Update-Button the Data should be updated by the BAL
and DAL.

Now my question:
how should the Data been passed through the tiers ?
By using Datasets or with Generic List<T> oder ?

So far i tried this:
DAL.getProducts provides a List<product> to the BAL
BAL.getProducts provides a List<product> to the UI
UI connects the List<product> to the Datagridview
BUT: How can i detect changed products ?

Ok, please be sorry for my bad english and i hope anybody understands
my problems.
I would be glad, i anybody has a example for me.

bye jogi
 
G

Gregory A. Beamer

The actual container for the data is largely inconsequential, esp. if
everything is .NET.

DataSets are fine, esp. if you do not have a lot of experience with custom
objects. If you use DataSets, you can determine rather easily what has been
updated without adding any additional code (a requirement of yours). And,
there are built in concurrency bits, so you can determine if data has been
updated by another user. There is a bit of overhead with all this built in
stuff, but it is fine for most applications.

If purely MS, you can use LINQ, although I am not fond of LINQ as a DAL. THe
entity framework is another direction to head, as it maps to objects. I am
not sure it is baked enough for all applications, but it does provide an
easy way of creating objects and mapping them to data points.

As far as seting up a Business Layer and a DAL, I am very fond of a
repository pattern as it provides inversion of control which makes testing
easier. This may or may not be an option depending on how much you have
already invested in your architecture.

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
 
A

Arne Vajhøj

jogisarge said:
i try to develop a winform pgm in three tier architecture(UI,BAL,DAL).

short example:
I have a winform with a datagridview which shows products.
I want to change data in the grid.
there is a button (update) on the form.
By clicking this button, the changed data should be updated in the
database.

1. By starting the programm the products should be loaded by the BAL
from DAL.
and delivered to the Datagridview.
2. By clicking the Update-Button the Data should be updated by the BAL
and DAL.

Now my question:
how should the Data been passed through the tiers ?
By using Datasets or with Generic List<T> oder ?

One or the other. Each has its advocates. I would say that
the trend change from DataSet to List<T> when moving from
small apps to large apps.

But an entirely different question: are you BAL providing
any functionality ?
So far i tried this:
DAL.getProducts provides a List<product> to the BAL
BAL.getProducts provides a List<product> to the UI
UI connects the List<product> to the Datagridview
BUT: How can i detect changed products ?

I am sure there is a way.

Arne
 
J

jogisarge

One or the other. Each has its advocates. I would say that
the trend change from DataSet to List<T> when moving from
small apps to large apps.

But an entirely different question: are you BAL providing
any functionality ?


I am sure there is a way.

Arne- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

hello,

my DAL has no business functions.
It only talks with the database and manipulates the database(SQL-
Server 2005 Express).

jogi
 
A

Arne Vajhøj

jogisarge said:
my DAL has no business functions.
It only talks with the database and manipulates the database(SQL-
Server 2005 Express).

BAL != DAL

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top