locked
Which way of doing DAL is better? RRS feed

  • Question

  • User-1833980242 posted

    I am doing some tutorials that use the DataSet that's provided by VS for the DAL.  This is the xml one that can be added to a project with a default name of "DataSet1.xsd".  My understanding is that the DAL can be done this way or written by hand with the traditional ADO.net objects.

    It's nice that this Data Set that was provided by VS made the process much easier to connect to a db.  It relieved me of having to write the ADO.net stuff.  I wonder if this is a good choice for all apps and if not, what the determining factors should be.  My guess is that a high traffic site would require a different approach.

    Can someone explain when this Data Set I mentioned should and shouldn't be used?  Does anyone know of any good articles regarding this? Thanks.


    Monday, February 8, 2010 10:28 AM

Answers

  • User1592241370 posted

    Hi,

    there are a lot of threads dicussing about this issue, and if you read all of them you can see different ways to do same thing, you must chose way that you prefer. I like NHibernate.

    You can read more about it in

    http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx

    DAL discussion

    http://forums.asp.net/t/1064744.aspx

     

    GOOD LUCK

     

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 10:39 AM
  • User626880745 posted

    they're good for quick and simple requirements.

    for complex or large systems they do add an overhead, and that besides the fact that you need to keep them in sync with database changes.

    you could refer to this article which discusses the advantages and disadvantages: http://www.informit.com/articles/article.aspx?p=169485&seqNum=7

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 10:42 AM
  • User-1179452826 posted

    xsd datasets are outdated, slow and down right evil. They're darn easy to set up but a nightmare to fix for changes or when things go wrong (which they do). You should definitely check out the modern ORM (Object Relational Mapping) technologies. The official Microsoft one's built into VS are Linq to Sql and the Entity Framework. Among these two, EF v1 has some shortcomings, but they're mostly fixed in v2 and v2 looks absolutely fantastic. v2 (called Entity Framework 4.0) is set to release with .Net 4.0 and VS 2010 on April 12, 2010. It's currently in beta and a planned RC is going to be released sometime this month.

    There are some good third party offerings too. Check out nHibernate and Subsonic.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 10:46 AM
  • User-1179452826 posted

    Datareaders and core ado.net is by far the fastest way to interact with the database. Whenever an ORM doesn't met your needs, that's your fallback.

    I'd recommend totally loosing xsd datasets.

    I'd recommend you start off by learning EF v4. If you know a little linq, it should be easy. You can just get the beta 2 / soon-to-be-released RC and by the RTM in April, you'll be ready. Using EF / Linq to Sql is so much easier and less of a hassle than the datasets that you'll find yourself using these technologies for most sites - regardless of expected traffic. In high traffic websites, there are ways to minimize the ORM overhead. These include compiled queries, caching etc. You'll be able to learn these advanced concepts further down the line. Initially, just start with EF v4 and see how it goes from there. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 6:07 PM

All replies

  • User-1379894896 posted

    Just a tip: You could give Subsonic a try http://subsonicproject.com/ to make it easier for yourself. (aim for version 2.x) 

    Monday, February 8, 2010 10:32 AM
  • User1592241370 posted

    Hi,

    there are a lot of threads dicussing about this issue, and if you read all of them you can see different ways to do same thing, you must chose way that you prefer. I like NHibernate.

    You can read more about it in

    http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx

    DAL discussion

    http://forums.asp.net/t/1064744.aspx

     

    GOOD LUCK

     

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 10:39 AM
  • User626880745 posted

    they're good for quick and simple requirements.

    for complex or large systems they do add an overhead, and that besides the fact that you need to keep them in sync with database changes.

    you could refer to this article which discusses the advantages and disadvantages: http://www.informit.com/articles/article.aspx?p=169485&seqNum=7

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 10:42 AM
  • User-1179452826 posted

    xsd datasets are outdated, slow and down right evil. They're darn easy to set up but a nightmare to fix for changes or when things go wrong (which they do). You should definitely check out the modern ORM (Object Relational Mapping) technologies. The official Microsoft one's built into VS are Linq to Sql and the Entity Framework. Among these two, EF v1 has some shortcomings, but they're mostly fixed in v2 and v2 looks absolutely fantastic. v2 (called Entity Framework 4.0) is set to release with .Net 4.0 and VS 2010 on April 12, 2010. It's currently in beta and a planned RC is going to be released sometime this month.

    There are some good third party offerings too. Check out nHibernate and Subsonic.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 10:46 AM
  • User626880745 posted

    yup, agree. I hope EF 4.0 doesn't have us discouraged this time! :)

    Monday, February 8, 2010 10:50 AM
  • User-1833980242 posted

    Thanks for the responses.  Should I also stay away from the regular ado.net stuff that's hand coded such as the data reader, data adapter...etc.

    I've worked with LINQ a little.  Would it make sense for me to learn EF instead of using the old fashioned ado.net stuff?

    Would the xsd datasets be ok for a small site with little traffic?

    Monday, February 8, 2010 1:08 PM
  • User-1179452826 posted

    Datareaders and core ado.net is by far the fastest way to interact with the database. Whenever an ORM doesn't met your needs, that's your fallback.

    I'd recommend totally loosing xsd datasets.

    I'd recommend you start off by learning EF v4. If you know a little linq, it should be easy. You can just get the beta 2 / soon-to-be-released RC and by the RTM in April, you'll be ready. Using EF / Linq to Sql is so much easier and less of a hassle than the datasets that you'll find yourself using these technologies for most sites - regardless of expected traffic. In high traffic websites, there are ways to minimize the ORM overhead. These include compiled queries, caching etc. You'll be able to learn these advanced concepts further down the line. Initially, just start with EF v4 and see how it goes from there. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 8, 2010 6:07 PM