OpenAccess Projections

2 posts, 0 answers
  1. Tim Lux
    Tim Lux avatar
    1 posts
    Member since:
    Apr 2010

    Posted 03 Nov 2010 Link to this post

    I am evaluating OA and ran accross this scenario which I don't know a best way to handle:

    The distributed content examples all use a changeset as the passed medium from presentation back to DAL to reassociated with scope.  In my use in an MVC environment, I am getting a projection of domain data for use on a particular view.  The projection is then my model for a page.  Can I get that projection back into a changeset (or be able to access the changeset directly in an MVC environment as the view's model?

    Flow:
    Controller asks business layer for data (will expect a DTO that will serve as the view model).
    Business layer defines specific filter (i.e., an ID)  to an IQueryable that is returned from the DAL.
    The business layer uses LINQ against the IQueryable to both apply filters and to project the output into a specified DTO.

    Controller recevies the postback DTO from the view, sends it to business layer, and then to DAL. 

    The only recourse I see at the moment to ave the data in the DAL is to get the original record (IScope and Extent), apply the changes to the record, and then save.  Works fine, but seems against the grain.  I assume it can pull the record from L2 cache, but won't I be losing concurrency checking unless I can use the ObjectContainer to reassociate?  I can't determine how to put the DTO back into a change set.

    I can provide a code sample if needed.

    Thanks
  2. Serge
    Admin
    Serge avatar
    375 posts

    Posted 08 Nov 2010 Link to this post

    Hi Tim Lux,

     Whatever method you choose you will always have to at one point loose some concurrency as the http protocol is stateless. The recommended approach would be to retrieve the object from in the DAL and update it's values with the one you retrieved from the view. While it might seem a little troublesome at first it is actually preferred. There would be no difference if the L2 cache is enabled or not, regarding concurrency. 

    The object container is a bit outdated and one could say deprecated. 

    Please do share with us if there is something that is bothering you with the suggested setup and maybe give us a little greater overview of the problem you are facing. 

    Sincerely yours,
    Serge
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top