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

4 posts, 0 answers
  1. richard
    richard avatar
    6 posts
    Member since:
    Jun 2014

    Posted 06 Jun 2014 Link to this post

    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
  2. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 10 Jun 2014 Link to this post

    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.
     
  3. DevCraft banner
  4. richard
    richard avatar
    6 posts
    Member since:
    Jun 2014

    Posted 10 Jun 2014 in reply to Doroteya Link to this post

    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
  5. Doroteya
    Admin
    Doroteya avatar
    502 posts

    Posted 12 Jun 2014 Link to this post

    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.
     
Back to Top