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

association error

6 Answers 29 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.
Chris
Top achievements
Rank 1
Chris asked on 21 Sep 2011, 11:07 AM
I created one-to-many relationship though using foriegn key.

For example, Book <-> Chapter.
Chapter has BookID foriegn key.

I can reference Chapter from Book but I cannot reference Book from Chapter.
Although Chapter has Book field, it says, "Chapter.Book threw an exception of type "Telerik.OpenAccess.OpenAccessException"

Hmmm....
For a comparison, I read in the same DB using EntityFramework Model and it works as expected.

Thanks.

6 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 21 Sep 2011, 03:12 PM
Hello Chris,

Could you please send us the code throwing this exception? Or you see this message only in the Quick watch window of Visual Studio?
Sometimes, if you have paused the debugging session for long time, it may happen that the database connection has timed out and the lazy-loading mechanism of OpenAccess cannot load the object you are trying to open in the quick watch. For a start, I would suggest you to try accessing the Chapter.Book property in code and see if it still cannot be read.

Greetings,
Alexander
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

0
Chris
Top achievements
Rank 1
answered on 21 Sep 2011, 10:41 PM
I'm not doing anything peculiar but simply trying to access automatically generated Book field from Chapter.
Error is not caused by delay loading.
        
       public MainWindow()
        {
            InitializeComponent();
 
            BookEntitiesModel bookModel = new BookEntitiesModel();            
            Chapter chapter = bookModel.Book.Where(i=>i.Id == 1).First().Chapters.First(i=> i.Id == 1);
           Book book chapter.Book;         }
 
Linq returns valid chapter with all other field has correct values but Book field has an invalid object.

I guess going from Book -> Chapters works ok but not the other way around.

Thanks.
0
Alexander
Telerik team
answered on 26 Sep 2011, 03:11 PM
Hi Chris ,

This is definitely not the expected behavior, however I was not able to reproduce it. Is there any chance to get the actual exception message from the OpenAccessException that you see? If not, please send us a support ticket with your project and include the database (or at least its schema), hopefully we will be able to reproduce the error using the exact same setup.

Best wishes,
Alexander
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

0
Chris
Top achievements
Rank 1
answered on 26 Sep 2011, 03:33 PM
Hi,
For a quick check, please let me ask this.
Id is unsinged int type and there are a couple of other problems related to "unsinged" data type.
Could it be also related?

Thanks.

0
Alexander
Telerik team
answered on 29 Sep 2011, 11:10 AM
Hello Chris ,

Thank you for the hint, I was able to reproduce the error with an unsigned int primary key. We will look into the problem and let you know when we have more details.

Greetings,
Alexander
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

0
Ady
Telerik team
answered on 07 Oct 2011, 05:32 PM
Hello Chris ,

 Sorry for the delayed reply. Currently there are certain problems with unsigned types as identity fields. We have added this with high priority for the Q3 release

We are sorry for the inconvenience caused.

Greetings,
Ady
the Telerik team

Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Chris
Top achievements
Rank 1
Ady
Telerik team
Share this question
or