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
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