accessing linq datacontext from dataLayer to BusinessLayer to GUIlayer RRS feed

  • Question

  • Context of my question;
    - In my dataLayer , I created en dbml linq datacontext
    - by adding a reference of the same dataLayer into my business layer  ( i could acces/use easily the datacontext)
    However to provide data to the GUI , presentationLayer , so far , I needed to create  a dataAdapterClass myself ( using linq commands ) which was returning list of different objects ( a object could be for instance customerObject , orderObject, etc ... )
    - in my presentationlayer , I needed to acces the data by way off the businessLayer ( = the goal , no direct access to datalyer)

    Is this the recommanded way ?
    Is there a walk-around to keep using the benifits of linq programming into the GUI layer? ( in respecting accesing to the data by way of business layer )

    Thanks in advance of you opinion .

    Tuesday, December 22, 2009 8:14 PM


All replies

  • hey bertoo,

    for best practices, you should visit the following link

    LINQ is not limited to DataContext.  you can use it with collections, entities, XML, and database.  things like extension methods, anonymous types are also there regardless of layer.  you can follow this link to learn more on LINQ.


    • Marked as answer by bertoo Wednesday, December 23, 2009 6:54 AM
    Tuesday, December 22, 2009 9:39 PM
  • Thx Kashif
    downloaded the Guide in  the mean time

    Regarding the Linq usage in de GUI , of course I can use it aganst iEnumerable objects like List<Customer> , an aray , etc
    Out of the above guide , I made the conclusion to hold the datacontext into the business layer only and return other objects throught the methods of this business class.

    thx again

    Wednesday, December 23, 2009 7:23 AM