Sharing the goodness…
Beth Massi is a Senior Program Manager on the Visual Studio team at Microsoft and a community champion for .NET developers. Learn more about Beth.
More videos »
I've been getting a lot of mails lately from people trying to build n-tier applications with Visual Studio 2008. Luckily, VS now makes it much easier to build these kinds of applications which have pretty much become the "norm" these days. Here's a feed of items I'm building that should help you get started.
I've been really busy this week tagging items like this in an effort to revamp the Visual Basic Learn area of the Dev Center. The content there is still very popular but it's looking pretty dated at this point since the release of Visual Studio 2008. Look for changes to roll out there very soon. If you have some favorite pages to share please pass them along! Basically I'm trying to surface some of the best content from the Library, How-Do-I videos, Webcasts, books, learning plans, and blog posts on a variety of topics. Look for more topics like WPF, WCF, WF to be added to the Learn tab as well.
PingBack from http://www.travel-hilarity.com/airline_travel/?p=2558
Looks like most of the samples are using DataSets. Do any of them use actual business objects? I can't stand these types of examples. There a lot of reasons to not use a DataSet.
There are at least 4 articles in the feed that explain how to do this. You can also take a look at this sample.
I know how, I work on n-tier applications every day. I Just hate working on everyone else crappy DataSet based code which is hard to maintain. By providing bad examples here, it just furthers the problems.
Keep in mind some people are not using LINQ/WCF yet.
Datasets are very useful in many scenarios, just because they do not fit well with your architecture doesn't mean that they won't work in other architectures. I have guidelines in the beginning of this article. http://blogs.msdn.com/bethmassi/archive/2008/04/12/linq-to-sql-n-tier-smart-client.aspx
If you're looking for information on SOA there is a good amount available on MSDN. You can start here: http://msdn2.microsoft.com/en-us/architecture/aa948857.aspx
I appreciate the work that went into these videos, but I found them extremely unhelpful. There are so many new concepts, and no explanation of why these new methods are being introduced. Why separate the data access layer into two classes? What exactly is an entity? Why use a service? What benefit do I gain by complicating things even further in this way? I watched both the Harry Miller "Creating an N-Tier Data Application" and your "How Do I: Use DataSets in an N-Tier Application" videos, and felt totally lost throughout them both. You both just click around and say "do this and this", without any real explanation of why to do it all.
Maybe in addition to the "How-Do-I" series, there should be a "Why-Do-I?" series.
Feeling really frustrated!
Check out http://msdn2.microsoft.com/en-us/library/ms973829.aspx for a good explanation of the tiers and why you use separate projects for each tier. It also goes into the benefits and disadvantages of n-tier and how to select how to architect your app.
I understand the benefits of the 3-tier system (presentation, business logic, data access), but these videos had even further compartmentalization (for example, splitting the DAL into two classes). I'll check out the article you recommended, but its six years old, so I don't expect it to cover the newer issues that well.
Thanks for the feedback. In the n-tier video I explain some of the common reasons for going n-tier like scalability and security reasons. The reason why you should take a layered approach to your architecture, regardless if you physically separate the tiers, is mainly for maintenance. Separation of concerns is key to any large system so that maintenance and testing costs stay down.
The article is still a good one to read on the "why-to", and you can use the videos as the "how-to". In the video I'm not separating the DAL into two projects. I'm separating the dataset generated code. There's a difference. Many systems use the DataSet as the data transfer object (the object that is serialized to the client) and in order to do that in a n-tier system you need to separate the structure of the dataset from the data-access logic stored in the TableAdapters.
The video shows how you can separate the concerns by moving the TableAdapter code (the data access layer) away from the structure of the data (the DataSets a.k.a entities) and how to share the types on the client and server so validation rules can be reused. This architecture should not be confused with SOA, but it is still a common architecture for systems written in all .NET (clients and servers).
p.s. YAG thanks for the link.
I've built an n-tier applications based on your demo videos and they worked well.
The second time I built it, the validaton logic is not working, the event in DAL is not firing, what could be a reason for that?
I guess now I know what I did wrong.
I used the DataSet exposed by the DataService instead of that exposed by the reference to the Business Logic Layer.
Why actually can't I work just with the service?
Like this the application interacts with the middle-tier BLL not just via a Data Service but also directly through the reference. What's the point then in using the Data Service?
In the video it demonstrates one way to build an n-tier app that has both a .NET client and server by type sharing the entities. The entities is ONLY the structure of the data and validation, not anything to do with the communication to the database. The service is the middle-tier that is hosted on a web server in this example. This stateless service allows you to scale out (farm) the middle-tier easily. If you allowed the client to connect to the data access layer directly then you would have a connected client-server application and you would need to invest in scaling your database server (which is costly) instead of just farming your service layer. This is a very common reason for building the application as n-tier. Additionally, even if you don't physically separate the tiers with a service, it's a good idea to logically separate them for maintenance reasons.
thanks for the prompt reply! Now it's clear to me.
All in all, I am very happy with the new features offered by VS2008 as they help tremendously to develop business apps quickly. I also found your article DS vs LINQ very interesting.
My other question would be, could you make a tutorial on how to deploy such a n-tier application?
As I understood from MSDN, there are several ways to deploy a service, even one without having to run IIS. That is great, because my employer wouldn't like an idea of running an IIS Server among Linux servers, simply because he has no admins for that.
By the way, we are using DB2 as the back-end and the n-tier architecture proposed here works with DB2 the same like with SQL Server which was a nice surprise to me.
I cannot try LINQ yet, because LINQ to Entities doesn't work with DB2 yet.
BTW I have another question.
All "how to do" videos are based on WinForms, why actually you are promoting only the Winforms?