Actually, I wonder if I could pick your brains as to the best way of doing this.
AccountsTransaction 1:0..1 NominalTransaction 1:m NominalEntry
(The NominalTransaction/NominalEntry can be considered atomic. My post-create script replaces the FK constraint with an ON DELETE CASCADE one)
So an AccountsTransaction (target per entity root, int ID with SCOPE_IDENTITY()) is standalone.
At some point (for certain inheritors), or immediately when created (for other inheritors,) a 'posting' is made which creates a corresponding NominalTransaction. I have a virtual CreateNominalPosting method which each inheritor overrides and produces a NominalTransaction tree.
Also, there is the situation where an AccountsTransaction will 'repost' so that means deleting the existing NominalTransaction tree and replacing it with a new one.
Currently, NominalTransaction has its own int PK with SCOPE_IDENTITY(). But since it can't (or shouldn't!) exist without an AccountsTransaction, I wondering if I can 'reuse' the ID somehow from the AccountsTransaction to ensure it can't get orphaned.
That plus an ON DELETE CASCADE so that whenever an AccountsTransaction is deleted, the NominalTransaction is automatically deleted.
What do you think?