This is a migrated thread and some comments may be shown as answers.

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

3 Answers 124 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
charan
Top achievements
Rank 1
charan asked on 17 Jul 2012, 05:09 AM
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.

3 Answers, 1 is accepted

Sort by
0
Viktor Zhivkov
Telerik team
answered on 19 Jul 2012, 12:53 PM
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.
0
charan
Top achievements
Rank 1
answered on 20 Jul 2012, 03:36 AM
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.

                  
0
Alexander
Telerik team
answered on 24 Jul 2012, 11:50 AM
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.
Tags
Databases and Data Types
Asked by
charan
Top achievements
Rank 1
Answers by
Viktor Zhivkov
Telerik team
charan
Top achievements
Rank 1
Alexander
Telerik team
Share this question
or