none
Data access layer questions RRS feed

  • Question

  • Hi

    I am coming from MS Access background and developing my first vb.net winform app with sql server backend. I have the following questions;

    1. I am bit daunted about the data access layer due to the sheer amount of code that needs to be written. Is there a way to speed up this process and also allow easy modification when underlying table structure is modified?

    2. Is it better to keep the DAL code at sql server instead of the front end app? If so should it be done in .net code?

    Thanks

    Regards

    Friday, October 29, 2010 10:10 PM

Answers

  •  

    Hi Yahya,

    1. There's a lot of code required but in most cases you can reuse quite a bit. Because of the reuse, you should have a look at the entlib 5.0 Data Block, see this link. That will speed up the process quite significantly.

    2. Yes and no. You should keep the DAL in a separate project and have the front end reference the DAL project. A lot has been written about these approaches, but the best explanation (in my opinion) is the app arch guide which you can find here. If you like to get started immediately, just put the DAL in a separate project and use the repository pattern. 

    Kind regards,
    Tom de Koning


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Tom de Koning Saturday, October 30, 2010 11:12 AM
    • Marked as answer by Y a h y a Saturday, October 30, 2010 2:16 PM
    Saturday, October 30, 2010 11:11 AM
  • Hi Yahya,

    You will gain many benefits with using the Data Block over L2S when there is a strong focus on stored procedures. If you are planning to migrate from Access to SQLServer I would strongly suggest to have a look at Entity. 

    The main difference between the entlib DAB and an ORM (like L2S or Enitty) is the use of stored procedures and ease of use. Where an ORM provides you with quite a bit of initial speed of development it is also important to consider the steep learning curve once you touch anything more advanced than the basics (ORM is more difficult).

    So, all in all it depends. If you focus on standard ADO.Net or have a lot of custom logic that you would store in SQLServer I would go for entlib DAB, otherwise I would opt for the benefits of and ORM (and then choose Entity over L2S as L2S is no longer in active development).

    Kind regards,
    Tom de Koning

     


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Tom de Koning Sunday, October 31, 2010 3:20 AM
    • Marked as answer by Y a h y a Sunday, October 31, 2010 9:19 AM
    Sunday, October 31, 2010 3:20 AM

All replies

  •  

    Hi Yahya,

    1. There's a lot of code required but in most cases you can reuse quite a bit. Because of the reuse, you should have a look at the entlib 5.0 Data Block, see this link. That will speed up the process quite significantly.

    2. Yes and no. You should keep the DAL in a separate project and have the front end reference the DAL project. A lot has been written about these approaches, but the best explanation (in my opinion) is the app arch guide which you can find here. If you like to get started immediately, just put the DAL in a separate project and use the repository pattern. 

    Kind regards,
    Tom de Koning


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Tom de Koning Saturday, October 30, 2010 11:12 AM
    • Marked as answer by Y a h y a Saturday, October 30, 2010 2:16 PM
    Saturday, October 30, 2010 11:11 AM
  • Hi Tom

    Many thanks. Just for clarity, what advantages would there be of using entlib 5.0 Data Block over L2S for comparison? Sorry for naive question as I'm pretty new at this and before going for a strategy would like to be clear as it is quite a significant MS Access app developed over 15 years that I need to bring over to dotNet/SQL Server platforms.

    Many Thanks

    Regards

     

    Saturday, October 30, 2010 6:09 PM
  • Hi Yahya,

    You will gain many benefits with using the Data Block over L2S when there is a strong focus on stored procedures. If you are planning to migrate from Access to SQLServer I would strongly suggest to have a look at Entity. 

    The main difference between the entlib DAB and an ORM (like L2S or Enitty) is the use of stored procedures and ease of use. Where an ORM provides you with quite a bit of initial speed of development it is also important to consider the steep learning curve once you touch anything more advanced than the basics (ORM is more difficult).

    So, all in all it depends. If you focus on standard ADO.Net or have a lot of custom logic that you would store in SQLServer I would go for entlib DAB, otherwise I would opt for the benefits of and ORM (and then choose Entity over L2S as L2S is no longer in active development).

    Kind regards,
    Tom de Koning

     


    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Proposed as answer by Tom de Koning Sunday, October 31, 2010 3:20 AM
    • Marked as answer by Y a h y a Sunday, October 31, 2010 9:19 AM
    Sunday, October 31, 2010 3:20 AM