Data Access Layer with the new DataSet
I have just begun testing the new VS.NET 2005 Beta 2 and I’m very impressed with the new features.
chemas-microsoft-com
ffice
ffice" />>>
I’m testing to translate a little project form VS.NET 2003 to VS.NET 2005. The old project is designed in 3 theirs (but only one solutions and without web services), with a Data Acces Layer, A Bussines Layer and the User Interface Layer (WinForms).
>>
Now I have discovered the new DataSet with the TableAdapter, and I’m looking for some information or design guides for a Data Layers / Bussines Layer design with these new components (some examples).
>>
Thanks and congratulations to the VS.NET development team>>
>>
>>
Alex Bibiano>>
Actually I have same kind of problem..
( I MIGHT BE WRONG !!! PLEASE DON'T CONSIDER THIS PART AS A CORRECT STATEMENT)
In my opinion : DAL is used to acces to the database, like SQL helper class and does not include business entity class .
Business Entity classes and CRUD functions belong to BLL.
UI should not communicate with DAL directly, UI should comunicate with BLL.
First question: Is what I said correct ?
In my opinion Visual Studio 2005 Dataset Designer creates both DAL and BLL in the same project. Typed Datatables and rows equvalent of the Business Entity classes. Data Adapters are the CRUD functions. In short : Dataset designer creates the BLL which includes the DAL in itself.
I got confused by the AspDotNetTutorials : Creating a Data Access Layer and Creating a Business Logoc Layer :
Creating a Data Access Layer : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnettut/html/aspnet_tutorial01_dataaccesslayer_vb.asp
Creating a Business Logic Layer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnettut/html/aspnet_tutorial02_businesslogiclayer_vb.asp
These tutorials say that UI should not access to DAL, but in my UI code I need such a statement
Public Sub AddPlaats() Dim mTable As New DAL.Prowonen.PlaatsDataTable
Dim mRow As DAL.Prowonen.PlaatsRow
For Each mRow In mTable.Rows
Dim plaats As New ucPlaats
plaats.PlaatsNaam = mRow.PlaatsNaam
plaats.PlaatsCode = mRow.PlaatsCode
Me.Controls.Add(plaats)
Next
End Sub
to be able to use the Datatable and Data row in my UI code I need to add referance to DAL .
LOOK WHAT BRIAN NOYES SAY :
There is one downside to the way the code is generated for table adapters. The code is injected into the same file as the typed data set definition. This means that the business entity type definitions (the data set, data table, and data row types) are physically coupled to the data access component type definition (the table adapter). This prevents you from being able to factor your business entity definitions into separate class library that is referenced from any consuming layer, while keeping the data access components in their own class library that is only referenced from the business layer. You can work around this by taking the code generated code and moving it into another project, but then you lose the designer support for modifying and maintaining that code. Perhaps this limitation will be addressed in a future version of Visual Studio. But for now, that is not a significant enough limitation to offset the huge productivity boon that the data set designer represents.
I think there are two things I can do.
1- I can create seperate classes in the same Windows Library Project where I created the Typed Dataset. These newly created clalsses will present the business logic
In this classes I create new CRUD functions which calls the Typed datsets CRUD functions and I push the business logic in these functions.
Finally, in my UI project I add reference to the Windows Library Project. So I can use the Datatable and row objects, and I can use the newly created classes as BLL for CRUD
2- I create seperate Windows Library Project apart from the Windows Library Project (DAL) , and call it BLL.
In this project I add reference to the DAL
I create new classes and CRUD functions which calls the DAL s cruid functions
Finally, in my UI I add a reference to the DAL and BLL . When I need to acces to the objects I use DAL and when I need to insert update delete I use the BLL.
I am more interested in the 1st sollution because : In the second sollution I need to add reference to the DAL twice (first in BLL second in UI). But if I use the 1st sollution My BLL and DAL will be in a same project and I don't think this is an ideal way..
Please HELP!! I am sooooo confused. Can somebody explain me how to solve this issue,
How to structure the DAL,BLL, UI ?
What should be in DAL ?
What is the most suitable sollution for nmy situation.
Pleasee!!!