detach dto from dal

2 posts, 0 answers
  1. Murilo
    Murilo avatar
    17 posts
    Member since:
    Jul 2012

    Posted 19 Jun 2012 Link to this post

    Hey, we are testing telerik's orm this week and we are facing some trouble, is it possible to detach the persisted generated classes generated by the orm to another project?

    This way we would only add a reference to the business layer and the dto layer and our programmers wouldn't be able to access the IQueryable objects but they would be able to access the persisted classes and send them to the business layer where they can access the IQueryable

    we are trying with the lastest release but we found no documentation about this scenario.

    Scenario:
    DTL -> contains the persisted classes generated by the DAL
    DAL -> contains the .rlinq file and will connect to the database
    BL -> can access the daos and the dtos
    View Layer -> contains all the user interface and will only have access to DTL and BL
  2. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 22 Jun 2012 Link to this post

    Hi Murilo,

    You could use the OpenAccessContext.CreateDetachedCopy<T>(IEnumerable<T> entities, FetchStrategy fetchStrategy) method to detach a collection of persistent capable instances, applying custom fetch strategy, in order to fetch additional referenced data. Later on the detached collection can be used in your scenario.

    Actually if you retrieve the context endpoints (context.Categories), and cache it after disposing the context instance you will be able to use the collection as well.

    Hope that helps.


    Kind regards,
    Damyan Bogoev
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  3. DevCraft banner
Back to Top