Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
N Tier Data Apps
Message
From
27/06/2010 20:11:21
 
 
To
27/06/2010 12:39:30
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, United States
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01470721
Message ID:
01470738
Views:
81
Yeah James, as Kevin said ... this is not a good practice and I don't know why people continue to show this methodology!! You're correct that the DAL layer should never be included in the UI layer. I believe that MS's creation of the TableAdapters in .NET 2.0 was a big mistake. Others may disagree, but I'm pretty sure that the majority of experienced developers will agree with me on this one.

That said, perhaps it would be beneficial to you to take a look at a few of my blog posts on the subject. I have a 3-part series on DataAccess that can be found here:

http://geek-goddess-bonnie.blogspot.com/2009/09/dataaccess-part-i.html
http://geek-goddess-bonnie.blogspot.com/2009/10/dataaccess-part-ii.html
http://geek-goddess-bonnie.blogspot.com/2009/10/dataaccess-part-iii.html

Each post adds extra complexity but more flexiblity. However, even just the information in the first post is enough to get you going and is a great starting point for those wishing to have more control over their data access (and to move away from using those confounded TableAdapters) In the first post is a link to my rant against TableAdapters ... you should read that too. <g>

~~Bonnie



>Hi All,
>
>I must be missing something. I watched an App Dev movie about creating n tier data layers. This was done by first adding a class library for the data access layer (DAL) and the adding another class library for the business logic layer (BLL). Once this was done, a winform was created and the data class was bound to the form. I started looking at the sample code and I noticed the the DAL class was bound to the form. I can find no where the BLL class was used except the DLL class has a using for the BLL class.
>
>This seams very strange to me because my assumption was the BLL class would be bound to the form and in turn the BLL class would use the DAL. Otherwise, how could the database be changed without changing the BLL clases as well. It has always been my assumption that the BLL should not know or care what the data store is.
>
>What am I missing?
>
>Here is the sample code used in the form.
>
>
>
>    public Form1()
>    {
>      InitializeComponent();
>    }
>
>      private NorthwindDAL.NorthwindDataSetTableAdapters.CustomersTableAdapter customersTA = null;
>      private NorthwindDAL.NorthwindDataSetTableAdapters.OrdersTableAdapter ordersTA = null;
>      private NorthwindDAL.NorthwindDataSetTableAdapters.Order_DetailsTableAdapter orderDetailsTA = null;
>
>    private void Form1_Load(object sender, EventArgs e)
>    {
>      customersTA = new NorthwindDAL.NorthwindDataSetTableAdapters.CustomersTableAdapter();
>      ordersTA = new NorthwindDAL.NorthwindDataSetTableAdapters.OrdersTableAdapter();
>      orderDetailsTA = new NorthwindDAL.NorthwindDataSetTableAdapters.Order_DetailsTableAdapter();
>
>      customersTA.Fill(this.northwindDataSet.Customers);
>      ordersTA.Fill(this.northwindDataSet.Orders);
>      orderDetailsTA.Fill(this.northwindDataSet.Order_Details);
>    }
>
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform