Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Is it recommended to use a WCF Service Library in developing an N-Tier Windows Application? Also is it better to use the VS wizards to create the DataTables and DataSets? And if so should I add all of my tables to 1 dataset or have a dataset for each table? This is all new to me and I want to learn it the right way.

share|improve this question
    
Do you need N-Tier application - Really? –  Emmad Kareem May 23 '12 at 21:26
    
If you're using the Entity Framework 4.2 you can use the POCO generator and put the [DataMember] attributes on the generated classes and pass those Objects around to all the other layers.. you can also create the context in the DB layer that you can attach / detach from.. it's pretty neat.. there is a little extra overhead with any FK contraints.. but it's worked well for me in the passed –  hanzolo May 23 '12 at 21:42

2 Answers 2

up vote 1 down vote accepted

Is it recommended to use a WCF Service Library in developing an N-Tier Windows Application?

WCF is a good way to access databases through fire walls. However if your application is an application used by users in the same office where there is a common LAN, I don't think the complexity would be justified. This is especially true if the database is owned and controlled only by this one application.

Also is it better to use the VS wizards to create the DataTables and DataSets?

In many cases, you need to taylor the data passed between the tiers or layers. I would suggest that you look into Entity Framework or another ORM to take care of this for you. Also suggestion by @Ourjamie is good.

should I add all of my tables to 1 dataset or have a dataset for each table? As a rule you need to optimize the data moved between tears/layer. Some times you don't need the features of a dataset (like tracking changes), so you don't use what you don't need. Your choice of a data structure will also be affected by the bind mechanism on the client and how you plan to notify the data layer of data changes. It is easier to use datasets but not always popular.

I suggest you assess your real need for an N-tier architecture (if N>2). Also, you may want to consider Microsoft RIA Services that may be easier for you than WCF. One last word, sometimes the skills of the team drives technology. Make sure your team is good enough in these technologies before commuting deadlines.

share|improve this answer

Yes but not with datasets or datatables. I would personally create a Library of Data Transfer Objects (DTO) comprised of primitive types, rather than (I assume) ado.net datatables. The reasoning is that datatables and datasets can be rather laborious to consume by non .net clients.

Secondly, you have a wide range of transport protocols with WCF and can with switch between tcp/ip or http as the demands of your service consumers alters.

I would read up on Juval Lowy's though from the iDesign.net site or books to get a better handle on things

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.