How to retrieve the data from different tables which are in different entity models

4 posts, 0 answers
  1. charan
    charan avatar
    29 posts
    Member since:
    May 2012

    Posted 17 Jul 2012 Link to this post

    hi,

    I am using Telerik open Access,I have three different Entity models like

               UserEntitiesModel->account_details
    ProfileEntitiesModel->biographic_details
    ContactsEntitiesModel->contact_groups_contacts

    I have three different tables in different Entitymodels. I want to load the data from all the tables,I used joins and wrote the lambda expression,but it is throwing an exception that "InvalidOperationException unhandled by user code".can u tell me how to retrieve the the data from different tables in different datamodels.


       I want to know is it possible to retrieve the data from different entity models using the lambda expression?If not how can we retrieve the data from different tables which are in different entity models.
  2. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 19 Jul 2012 Link to this post

    Hello Charan,

    Currently where is no way to use more then one data model in a single server-bound LINQ query.
    You have two options:
    1. Modify the one of your data models so it contains all the entities that are related (via database relations or conceptual business rules). Entities that are standalone can continue to live in separate data models. Keep in mind that DataModel1.Car and DataModel2.Car entities are completely different entities from the viewpoint of OpenAccess and .Net Framework even though they are mapped to the same database table.
    2. Customize your entities with additional properties for your conceptual business rules. Manually set these properties in your code (in memory as opposed to on server!). Do not forget to exclude these properties from the persistence mechanism of OpenAccess.

    Please share with us why are you separating your entities into different business model?
    If you need any further assistance please post your data models and the queries that you are trying to implement against them.

    Greetings,
    Viktor Zhivkov
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
  3. DevCraft banner
  4. charan
    charan avatar
    29 posts
    Member since:
    May 2012

    Posted 19 Jul 2012 Link to this post

    Hello Viktor,
                 Thanks for the reply.I used this because of efficiency and execution time.I have implemented this like I took two different queries to get the data from two different Datamodels using ToList() .and in the third query i used the data coming from last two queries joined with third datamodel. I have implemented like this and it is working fine.

                      
  5. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 24 Jul 2012 Link to this post

    Hi Charan,

    We are glad to see that you have found a solution.
    Please do not hesitate to contact us if you need further assistance.

    All the best,
    Alexander
    the Telerik team
    OpenAccess ORM Q2'12 Now Available! Get your hands on all the new stuff.
Back to Top