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

Telerik.OpenAccess.Exceptions.NoSuchObjectException was unhandled by user code

3 Answers 271 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
richard
Top achievements
Rank 1
richard asked on 06 Jun 2014, 01:24 PM
Hi,

I have created a domain model with two related entities, the relationship is an optional 1 to many.
There are some instances where the relationship is not possible and this is causing the below error:

Telerik.OpenAccess.Exceptions.NoSuchObjectException was unhandled by user code
Message=No row for Entities.Person ('Person ') GenericOID@18cde365 Person ID=838320

I have turned on the model setting "Return Null on Row Not Found" but this seems to make no difference.

Can anyone help me solve this, this is yet another issue I have found with data access and it is getting to the point where I will have to switch to another ORM.

Thanks,
Richard

3 Answers, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 10 Jun 2014, 07:23 AM
Hi Richard,

The error you experience is expected with the following setup:
- nullable foreign key of the child table in the database;
- not nullable foreign key property of the child class in the domain model;
- a new object of the child class is added to the context with a non existing value for the foreign key property (for example: 838320);

In this case, you can resolve it by making sure that the foreign key of the child table is nullable in the database, updating the class from the database with the help of the Update From Database wizard, and leaving the foreign key property of the new instance unassigned.

I hope this helps. If the described scenario does not match yours or the error persists, do not hesitate to get back to us.


Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
richard
Top achievements
Rank 1
answered on 10 Jun 2014, 10:08 AM
Hi Doroteya,

thank you for your help it is much appreciated.

I have checked your criteria and my setup is:
- The foreign key of the child table in the database IS nullable.
- The foreign key property of the child class in the domain model IS nullable
- No new objects have been created in any context as this is a simple read excersise.

One other thing i have noticed is that running the telerik 'Add Telerik Data Access Service',  visual studio is held open, as when i try to close it i get a warning saying that ' Microsoft Visual Stuiod has detected that an operation is blocking user input. this can be cause by an active modal dialog or task that need to block user interaction. Would you like to shut down anyway?'

I'm using Visual Studio 2013 with Windows 7 64bit SP1, i'm thinking there could be some incomplete process in the wizzard?

Many thanks,
Richard
0
Doroteya
Telerik team
answered on 12 Jun 2014, 07:15 AM
Hi Richard,

Thank you for your feedback.

Regarding the error you experience, I am unable to completely understand the situation on your side and it would be highly appreciated, if you could provide a code snippet with the reading operation that does not work properly.

Additionally, in general it is expected for Visual Studio to ask you whether you are sure about closing it when Service Wizard is running. By design, the wizard uses a window that runs inside Visual Studio and the studio takes care for you to not loose any unfinished tasks or unsaved changes.

I hope this helps. I am looking forward to your feedback.


Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Data Access Free Edition
Asked by
richard
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
richard
Top achievements
Rank 1
Share this question
or