in

Community

Take part in the community surrounding CodeBreeze and other products from SteelBlue Solutions.
Latest post 10-10-2008 6:36 AM by shawndewet. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-08-2008 4:11 AM

    Parent/Child relationships

    Just to confirm something with Target Tags when I want to implement a parent/child relationship among business entities; e.g. lets say I have a SalesOrderHeader and SalesOrderDetail table; on the SalesOrderHeader business entity, I need to set the IsParent target tag to True and the Child target tag to SalesOrderDetail; then on the SalesOrderDetail business entity I need to set the IsChild target tag to True, and the Parent target tag to SalesOrderHeader. 

    Is my understanding correct here - that I have to set these properties on both objects in the relationship?  I'm thinking surely I just need to set the target tags on the child table?  ie, set its IsChild to True, and its Parent to SalesOrder; this relates to a problem that I have in trying to set up a parent child relationship when I have a parent table that has more than one child table: "what value do I put into the Child target tag of the parent table?"

    Or is my thinking flawed here?  Am I perhaps looking for the solution in the wrong place (the target tags)?  Perhaps my solution would be in modifying the templates...could I modify the template such that when generating code for a parent business entity, instead of saying something like "If my IsParent target tag set to true, then generate code as if I am a parent", to rather say "if there are other business entities that have their Parent target tag set to [me], then generate code as if I am a parent"?  Can this be done?  Can the target tags of other business entities be queried in a template while generating a given business entity?

  • 10-10-2008 3:20 AM In reply to

    Re: Parent/Child relationships

    Remember, target tags are completely free-form.  The reason you need to set these in both a parent and a child is simply because the templates reading them use those values.  Since a single target tag is just a string value, to account for a one-to-many situation, you can simply place a comma-delimited value into a target tag assignment.  Then you would need to modify the code template to parse that out.  My advice is that you do that parsing in a helper method on a code template code-behind class.

    Did I answer your question well enough?

  • 10-10-2008 4:04 AM In reply to

    Re: Parent/Child relationships

    Thanks Miguel,

    This does clarify the use of target tags.  I just need to know one thing still...can the target tags of business entity X (or any other business entity for that matter) be queried/accessed by template code while generating the code for business entity Y?  If so, I could then write code in the template that says something like "If there are OTHER business entities whose target tags define me as their parent in their target tags, create my code as a parent object, and add code to treat each of them as my children".

     

      

  • 10-10-2008 6:36 AM In reply to

    Re: Parent/Child relationships

    Hey never mind. I just found the answer, and what I was asking is exactly what I found when looking into the code of a business base template:  It is looking for the target tag settings of OTHER entities in determining whether or not it should generate as a parent or not:

     For Each otherEntity As BusinessEntity In _Project.BusinessEntities

    If otherEntity.Tags("IsChild").Value.ToLower() = "true" Then ...

     

Page 1 of 1 (4 items)
2008 - All rights reserved
Powered by Community Server (Commercial Edition), by Telligent Systems