ORM with Web Client Software Factory

2 posts, 0 answers
  1. Sarulatha Selvan
    Sarulatha Selvan avatar
    10 posts
    Member since:
    Sep 2008

    Posted 28 Nov 2010 Link to this post

    Ours is a Web application utilizing the Web Client Software factory patterns and practices from Microsoft.
    This involves data objects to be transported across multiple layers.
    UI layer View and presenter
    BUsiness module layer
    Data access layer

    All our ORM transactions are carried out at the data access layer. I would like you to provide suggesstion on how to implement a best posible solution.. Find below our curent approach

    WE create the Objectscope in the DAL for the first time and keep it open.Assume i would like to list products in Radgrid and perform add and edit on it.

    Step 1-- Using the objectscope i would get the list of products like objectscope.extent<Product> and use ToList to convert to List<Product>
    This list is transported all the way to UI and assigned to the grid datasource

    Step 2--User selects a record in the grid and performs edit..we use Popup edit form so the dataitem is transferred to the edit form and i store the same to viewstate.NOw the user edits the data and click the save button the object is again transfeered back all the way to DAL to update it.Where in again in DAL i retrieve the same record and copy the values from the object whihc i transferred from UI layer within a scope.transaction.

    My question does the product object is still persistent when i retrieve from the radgrid item command dataitem or it is just a transient item. I guess it is transient as iam not opening any transaction to edit its values in the UI.Need to know once the data is loaded to grs the object becomes non persistent or still it is persistent.

    also in certin situation we would be using asp.net wizard as a popu edit control by storing the dataitem in session and tranferring across pages.

    please let us know your comments on our aproach or suggest best possible solution.Since we are using diffent layers would the maser page or the httpcontext would wok for us?
  2. Zoran
    Zoran avatar
    534 posts

    Posted 30 Nov 2010 Link to this post

    Hi Sarulatha Selvan,

     I would not suggest you to put the OpenAccess persistent objects into the View or Session state as they are not serializable and your projects will not work with such architecture on a web farm. This also prevents them from being sent over the wire in a web service scenario. I suggest you to use transporting objects that reflect the OpenAccess persistent objects for those purposes in the upper layers. Please have a look into the following sample application which shows the suggested practices for N-Tier development

    As for the scope handling approach, I would suggest you to use the HttpContext one as that is something you can handle in lower layers unlike the Master Page which is the UI Layer.

    Kind regards,
    the Telerik team
    Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
  3. DevCraft banner
Back to Top