0

I want to be able to have a relationship between a parent "article" entity, and many child "image" entities, but have the identity of the child start at zero in relation to each parent.

I'd imagine that involves 2 primary keys defined in the child "image" entity, something like "ArticleID" and "ImageID", but I have no idea how to automatically increment the ImageID for each new child, from a zero base. Not sure it's possible to define this in a DB at all (possibly needs to be supplied by the app).

Does anyone have any advice on this?

  • Article (100)
    • Image (100_0)
    • Image (100_1)
    • Image (100_2)
  • Article (101)
    • Image (101_0)
    • Image (101_1)

...and so on...

Gers
  • 338
  • 3
  • 9

0 Answers0