Saving of hierarchical data in one go
 
Forums / SmartComponent Library - Developer Forum / Saving of hierarchical data in one go

Saving of hierarchical data in one go

3 posts, 0 answered
  1. Patrik Wikström
    Patrik Wikström avatar
    70 posts
    Registered:
    15 Oct 2018
    11 Sep 2019
    Link to this post
    Maybe someone here on the forum has some good solutions to this one?

    Say you want to save Invoice, InvoiceLine and maybe some third related table in one go and you want to update the real new InvoiceNumber to the Invoice and InvoiceLine tables and then additionally the new key values of the InvoiceLine table to the third table etc., how would you solve this in a nice way? Would you use a invokable method in the business entity that takes the dataset as input and has some temporary values in the key-fields assigned for the joins to work and use the normal saving routines and maybe have some mapping mechanism (proeprty that "activates" this functionality) for temporary-values vs new key values (maintained during the save) or would you solve this in a separate business task? Thoughts?
  2. Patrik Wikström
    Patrik Wikström avatar
    70 posts
    Registered:
    15 Oct 2018
    23 Oct 2019 in reply to Patrik Wikström
    Link to this post
    Anyone have some solutions to this one?
  3. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    23 Oct 2019 in reply to Patrik Wikström
    Link to this post

    You know that inheriting meaning full keys - especially over three tabels and not only two - is so 1980's? 

    You have not provided any info on how those Invoice numbers are built. Does it need to happen as part of the transaction (unnecessary complication, see above)? 

    One place to implement this, would be in Validate Data. Or an SaveChanges override in the Business Entity.

     

3 posts, 0 answered