I am new in C# programming and in OOP. I need to dive into web applications for my company, and I need to do it fast and correct.

So even that I know ASP.NET MVC is the way to go, I want to start with some simple applications with ASP.NET Webforms and then advance to MVC logic.

Also regarding my db classes: I plan to create common database classes in order to be able to use them either from WinForms or ASP.NET applications.

I also know that the way to go is to learn about ORM and EF. BUT I also want to start from where I am feeling comfortable and that is the traditional ADO.NET way.

So about my Data Access Layer classes:

  • Should I return my results in datasets or arraylists/lists?

  • Should my methods do their own connect/disconnect from the db, or have separate methods and let the application maintain the connection?


INMO the idea to give up EF and other ORMs is not a very good one if you are intending to produce a professional production application today that will be used as part of a larger project. This was viable option in the early days of .NET.

The advantages of using EF/ORM are so many and if you program for living, you will probably have to learn about it anyway, so do it now if you can.

Datasets are easier to use and program with but some people hate them. If you are not strong in OO, datasets will help you go quicker but this approach is usually criticized.

Connection to the database should be centralized and hidden from client code. It is common to use the Factory pattern to create objects. You start a transaction by establishing a connection and then close it. Closing a connection in code does not always physically close the connection, instead it returns it the pool of available connections. So yes, you issue close implicitly or explicitly in your methods code.

I would like to recommend to you to spend some time with a book that takes an application from start to end to see your questions answered in more details. There are several concepts that you need to be aware of to get your application performing well and secure. Also, differentiate between training projects and production projects. Web development is not trivial and it takes sometime to learn and master.

  • I have the liberty of creating some small apps for the beggining thats why i would like to go the old way first. to be ready to understand EF / ORM better. – e4rthdog Apr 7 '12 at 9:08
  • Yeap i do separate the types of projects but usually in a business-driven environment you have to advance with less-secure ways in order to get the business done. Then you can revisit topics that need to be adjusted. Programming is not my every day job although i am doing it now and then for 15 years. My mistake was that even if i love it much i stayed in easy implementation s with VB in order to provide. My days are filled with ERP processes / SQL / BI. I have decided to dive well into OOP and C. I find myself usually smiling whenever i find that there is always much to learn. – e4rthdog Apr 7 '12 at 9:46
  • I hear what you are saying. Things are getting too complicated for any one to grasp all aspects of it. I miss the old days where one could learn almost every part of the technology the application is built in. – NoChance Apr 7 '12 at 9:56
  • +1 for your last words...Back then it was like taking one dog for a walk. now is like having 10 dogs with different strengths and speed, and you have to take them ALL for a walk :) – e4rthdog Apr 7 '12 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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