0

I have 4 tables that I'm trying to create: Term, Courses, Assessments, and Notes. Term has a one-to-many relationship with Courses, and Courses has a one-to-many relationship with Assessments and Notes.

My question is, is it possible to format my objects to pull everything with a single call to database.GetAllWithChildrenAsync();, or does SQLite-Net Extensions not work like that.

I've tried many many different things, but Assessments and Notes never pull over. I can pull each term and their associated Courses, but the Courses associated Assessments and Notes are always null. I asked another question that is similar here, but for this question I'm simply wondering if it's even possible.

If anyone has any code that contains a working nested one-to-many implementation, that would be greatly appreciated. The documentation here includes many examples, none of which that shows nested one-to-many relationships. I've been stuck on this issue for several days now and am starting to go a bit crazy.

[Extra Info] I've tried various different insertion methods (mixtures of each as well), including the following:

  • Insert each object separately then call UpdateWithChildrenAsync(term).
  • Adding Cascading options of to both Terms and Courses.
  • Toggling recursion on both InsertWithChildrenAsync and GetAllWithChildrenAsync.
  • [Note] Toggling recursion on GetAllWithChildrenAsync with Cascading Options for either all or read result in the app immediately crashing.
Knight Steele
  • 169
  • 4
  • 14
  • Post the code and the crash. Adding cascade operations and using `recursive: true` when inserting and fetching is the way to go. – redent84 Jan 22 '21 at 08:56
  • You can toy around the working examples to see what's wrong with your classes: https://bitbucket.org/twincoders/sqlite-net-extensions/src/master/Tests/IntegrationTests/Tests/RecursiveWriteAsyncTests.cs – redent84 Jan 22 '21 at 08:57
  • @redent84 I looked at those examples for a while and tried several of the ways that they have things set up, but to no avail. Non of the examples contain nested one-to-many implementations. As for the code, my first link links to another question with my code in it. – Knight Steele Jan 22 '21 at 09:29
  • I saw your code there. None of it has the cascade attributes or uses recursive operations, and it doesn't contain the specific error that you're having. – redent84 Jan 22 '21 at 10:01
  • please do not post the same question multiple times – Jason Jan 22 '21 at 10:06

0 Answers0