Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Developing 3 Tier Apps using VS2008 & Data Binding

Status
Not open for further replies.

Kieran777

Programmer
Apr 23, 2003
26
0
0
AU
Hello

I am planning to develop an application that will be N-Tier (3-Tier} using Visual Basic in Visual Studio 2008 (VS 2008).

By 3 tier I mean:
Tier 1) Handles User Interface/Presentation,
Tier 2) Applies Business Rules/Logic (Validation of data etc) and
Tier 3) Data management (retrieve, store etc).

Previously in VS 2005 I have created 3 tier applications. However, with VS 2005 I have never used data binding of the form fields to the datasource because:
a) I considered it was not flexible enough and
b) I could not easily keep the business logic in Tier 2 separate from the tier 1 presentaion or tier 3 data access.

BUT in VS2008 after viewing the video from Beth Massi on 'How Do I: Use Datasets in an N-Tier Application' refer:


it appeared that Data Binding is much better catered for in VS2008 and that it seemed the best way to go when developing applications as it reduced coding etc and visual designers could be used to improve productivity etc when working with DataSources. Aslo Data binding appears much improved.

In VS2005 I would create the 3 Tiers as separate projects in the one solution (the same as in the video on VS2008]. I would create a refererence from Tier 1 to Tier 2 so I can access the business logic. In tier 2 (Business logic) I created a reference to Tier 3 (the Data Management tier) so that the business logic tier can action a data save or retrieve apply business rules to data before handing it to the tier 1 for presentation. NB: The way I set up my references was different to the video on VS2008 N-Tier.

[Red]OK so this gets me to my problem.[/Red]

In the VS2008 How to video from Beth Massi a reference is set up from Tier 1 to Tier 2. Then when in the Tier 3 (Data management Tier) a datasource can be added via a designer.

VS2008 allows for N-Tier in the designer through a feature called N-Tier Datasets which basically allow you to specify in the Dataset designer a place where the data access code should be generated and where the dataset structure and validation code should be put. This allows you to physically separate these classes and allows you to share only the data validation code on the client whilst leaving the data acess code (the table adaptor code etc) on the server. In the Video the N-Tier solution uses a WCF Service to access the Tier 3 DAL (to retrieve, save data etc). The Tier 3 has a reference to Tier 2 to apply business logic to returned dataset.

[Red]My problem with this is that I don't want to use a 'WCF service' in my application to action data retrieves or saves etc.[/Red] I must admit that I don't really understand WCF services and also are reluctant to introduce another variable in my applications that could cause problems (like service not setup or running etc. I would rather action the Retrieve dataset from the form_load event in the Tier 1 without using the WCF Service.

Because the solution on the video uses the WCF service i.e. the Tier 1 Client/Presentation tier includes a reference to the WCF Service, and also a reference to Tier 2. Tier 3 has a reference to Tier 2. Tier 2 has no reference to Tier 3 (and I can't create one because it would create a circular reference), hence I can't action for example a retrieve of a dataset in the form_load event without using the WCF Service. (NB: Previously I would have written the code in Tier 2 which called a retrive of the data from Tier 3 then applied any busines rules to the data and handed it to Tier 1 for presentation, but using VS2008 designers and data binding I can't do this without using the WCF service).

I would like to use data binding now in VS2008 as it appears to have matured somewhat. Also, I embrace N-Tier in all new applications I design as I have found them to be much more maintainable and logical to develop.

I want to know if anyone else has experience with N-Tier particularly considering the VS2008 improvements?

Does any one have a way of using the VS2008 designers etc and developing without using a WCF Service? or is it not possible to do when using the VS2008 datasource designers?

Any comments or advice or clarification would be appreciated. Also any advice on WCF service would be appreciated.

regards
Kieran777
 
Hello Kieran777:

Did you ever receive an answer? I am pondering the same things.

Which direction did you end up going?

Thanks in advance,
Rick
 
Hi Rick,

No I didn't receive an answer.

I haven't spent too much more time on it but I have persisted with using the WCF service, I could not get it to work any other way (ie using 3 tier and data designers with data binding).

I didn't want to add another layer of complexity to the new application (ie including the reliance on WCF service) because I want to keep it simple and uncomplicated as possible.

I have developed previous applications in VB3 which were very robust in terms of users just installing and running with minimum requirements in way of support and I want future applications developed in VS2008 to be as robust.

Also, I am finding that the first time I request the records from the database that the WCF service must startup and this takes about 5 seconds on my dual core vista notebook. Subsequent requests for data are 2-3 seconds. This does impact on my application in that the user can't do anything until the data is returned. I know I can display something like load status or splash screen to user but I would rather it load like almost instantaniously for the user as it does if I don't use the WCF service to request the data. The only point I make is that then I would not be using the 3 tier, data designer and data binding togther to get those other advantages.

So any comments welcome.

regards
Kieran777

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top