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

navigating entities

1 Answer 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex VonBrand
Top achievements
Rank 1
Alex VonBrand asked on 02 Feb 2011, 05:08 PM
I have just started looking at Open Access again after about a year.

It looks much improved, especailly for Oracle.  I do have a question though about navigating the Object Graph of Entities.

I have create an a .rlinq model of tables in an Oracle 11g database.  I have configured the associations in the model designer.

When I access the model from within the project that holds the model, I can navigate perfectly through the entities using dot notation:

DSTUModel.

 

EntityDiagrams1 cntxt = new DSTUModel.EntityDiagrams1();

 

 

 

var student = (from s in cntxt.STUDENT_DETAILs where s.STUDENT_ID == "9999999" select s).FirstOrDefault();

 

 

 

string teacherName = student.STUDENT_CLASS_SCHEDULEs[0].SCHOOL_CLASS_SCHEDULE.EMPLOYEE_DETAIL.FIRST_NAME;

So in this case I get a student entity and navigate to the student class schedule entity then to the school class schedule entity and then finally to the empolyee_detail entity.

This works fine.

But if I reference the model in a different project either through an assembly reference or a DataService, the navigation does not work.

So in the above query in can easily retrieve the first entity STUDENT_DETAIL , but when I access the related class property to get the collection of STUDENT_CLASS_SCHEDULEs, this collection is never retrieved.

I can retrieve the collection by doing a join in a linq query, but the dot notaion naviagion does not work.
I have tried setting the LoadBehavior property to Eager, but this has no effect.

I am not sure if I am just not getting something, or if this is by design.

If there is a way to use the dot notation navigation when accessing the model through an external assembly reference, could you point me in the right direction?

Is there some programmatic way I can create the the associations?

Thanks,
Alec von Brand
 

 

1 Answer, 1 is accepted

Sort by
0
Petko_I
Telerik team
answered on 07 Feb 2011, 08:06 PM
Hi Alex VonBrand,

Can you elaborate a bit more on the scenario you are trying to accomplish? We have tested locally with specifying an external assembly Data Access Layer reference but did not find any unexpected behavior regarding the traversal of associations. We have also tested against an Oracle and a MS SQL Server database. Do you receive an exception during runtime? If so, is it a null reference exception? Can you prepare a small test project to demonstrate how the associations navigation is broken? Is the behavior you mention observable on any project which references a DAL externally? We suppose there might be something in the setup that is causing the pattern you observe. 

We are looking forward to resolving this issue.

Best wishes,
Petko_I
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Tags
General Discussions
Asked by
Alex VonBrand
Top achievements
Rank 1
Answers by
Petko_I
Telerik team
Share this question
or