DAL in Winforms/Access Database combo... Would like to hear your opinion!

S

Sasha

Hello Everyone,



I would like to solicit some opinions on the question that was discussed
many times and started ungodly number of flame wars. Are you excited yet? :)
Is it going to be Linux vs Windows or Vim vs Emacs?



Well, it is neither one of the above mentioned. Today's topic is Data Access
Layer aka DAL. Just like mentioned before, a lot was said about it. But
every discussion that I found in this newsgroup was ASP.NET/SQL Server
related. I would like to hear some thoughts on DAL in WinForms applications
with local Access database as a backend.



I would like to ask people that have experience working with this kind of
setup to share some thought.

Here is the list of my questions and some of my remarks:



1.. Layers. How many layers do you usually use? It seems like the most
common approach is to use the following layers: Presentation, Business
Logic, Data Access Layer.
2.. Model - View - Controller. If you try to use this pattern,
Presentation layer becomes View, Business Logic Layer becomes Controller and
Data Access Layer becomes Model. Right?
3.. How do you pass data between layers? Some of the possible options:
-DataSets(Supports tables and simple relationships. If you have recursive
relationships or something of that kind, the usage of DataSet becomes more
difficult. How do we use it as a Model? Do we load all of it into memory and
databind UI to it? It will work if the database is small: And what do you
return if there is only one time? You still create the whole DataSet that
has only one record?)
-Strongly Typed DataSets (STDS). Same things as DataSets but typed. Works
great with Intellisense. A lot of problems of DataSets applies. (How many
DataSets do you need? Let's take Customer and Order tables. Do we have to
create Customer STDS, Order STDS, CustomerOrderSTDS?)
- XmlNodes. Works, but why would you use it? Seems like a lot of work and
quite resource intensive to pass between layers:
- Custom Business Objects. Small, support Intellisense and are not coupled
to the database. But persisting it to the database cannot be real pain in a
neck. But because it is a standalone application, I do not have to worry
about concurrency and other problems from a multi-user environment. Seems
like a way to go, but you still have to something like Unit of Work or
Mappers from Fowler.
4.. How do you link Model and Views. If you use dataset as Model, you can
use databinding, or events if you use custom BOs.


That's it for now. I would love to hear your opinions and suggestions.



Thank you,

Sasha
 
M

Manoj G [MVP]

Hi Sasha,

The DAL is a helper that can be called from any type of application - be it
Winform, WebForm or Mobile Form ...whatever. or atleast it should be
designed in such a way. Going one step ahead, you can even design it in a
way that it works with any data source, transparently.
For deciding what to use for data transport , there is no one answer to it.
It all depends on the type of your app. If you havent read this already,
then have a look at this fantastic reference Designing Data Tier Components
and Passing Data Through Tiers ->
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
BOAGag.asp
 
S

Sasha

Thank you for your answer. Yes I have read this article, and indeed it is a
very good article. I also read Martin Fowler's "Enterprise Application
Patterns" which is also a great read.

But I just want to hear what people do in their own projects. What
directions they take...

Take Care,
Sasha


Manoj G said:
Hi Sasha,

The DAL is a helper that can be called from any type of application - be it
Winform, WebForm or Mobile Form ...whatever. or atleast it should be
designed in such a way. Going one step ahead, you can even design it in a
way that it works with any data source, transparently.
For deciding what to use for data transport , there is no one answer to it.
It all depends on the type of your app. If you havent read this already,
then have a look at this fantastic reference Designing Data Tier Components
and Passing Data Through Tiers ->
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
BOAGag.asp

--
HTH,
Manoj G [.NET MVP]
http://www15.brinkster.com/manoj4dotnet


Sasha said:
Hello Everyone,



I would like to solicit some opinions on the question that was discussed
many times and started ungodly number of flame wars. Are you excited
yet?
:)
Is it going to be Linux vs Windows or Vim vs Emacs?



Well, it is neither one of the above mentioned. Today's topic is Data Access
Layer aka DAL. Just like mentioned before, a lot was said about it. But
every discussion that I found in this newsgroup was ASP.NET/SQL Server
related. I would like to hear some thoughts on DAL in WinForms applications
with local Access database as a backend.



I would like to ask people that have experience working with this kind of
setup to share some thought.

Here is the list of my questions and some of my remarks:



1.. Layers. How many layers do you usually use? It seems like the most
common approach is to use the following layers: Presentation, Business
Logic, Data Access Layer.
2.. Model - View - Controller. If you try to use this pattern,
Presentation layer becomes View, Business Logic Layer becomes Controller and
Data Access Layer becomes Model. Right?
3.. How do you pass data between layers? Some of the possible options:
-DataSets(Supports tables and simple relationships. If you have recursive
relationships or something of that kind, the usage of DataSet becomes more
difficult. How do we use it as a Model? Do we load all of it into memory and
databind UI to it? It will work if the database is small: And what do you
return if there is only one time? You still create the whole DataSet that
has only one record?)
-Strongly Typed DataSets (STDS). Same things as DataSets but typed. Works
great with Intellisense. A lot of problems of DataSets applies. (How many
DataSets do you need? Let's take Customer and Order tables. Do we have to
create Customer STDS, Order STDS, CustomerOrderSTDS?)
- XmlNodes. Works, but why would you use it? Seems like a lot of work and
quite resource intensive to pass between layers:
- Custom Business Objects. Small, support Intellisense and are not coupled
to the database. But persisting it to the database cannot be real pain
in
a
neck. But because it is a standalone application, I do not have to worry
about concurrency and other problems from a multi-user environment. Seems
like a way to go, but you still have to something like Unit of Work or
Mappers from Fowler.
4.. How do you link Model and Views. If you use dataset as Model, you can
use databinding, or events if you use custom BOs.


That's it for now. I would love to hear your opinions and suggestions.



Thank you,

Sasha
 

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