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
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 >>
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.
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 >>
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.
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 >>
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.