locked
Variable Related or Navigation Properties RRS feed

  • Question

  • I have been combing manually through my Project's Application Definition to find changes I made since I might have to rebuild it. Anyways I was looking at the code for relationships of properties within an entity and found two types of code.

    Related Properties
    <EntityProperty Name="RelatedProperty1"
                            PropertyType=":String:">
         <EntityProperty.Attributes>
              <MaxLength Value"255" />
         </EntityProperty.Attributes>
    </EntityProperty>

    Navigation Properties
    <NavigationProperty Association="Entity1_Property1"
                            FromEnd="Entity1"
                            Name="Property1"
                            ToEnd="Property1" />

    This looks like pretty basic XML what I want to do is change the "Name" and/or "Association" to a "Var" variable instead of just a plain one to one link I could use an If...Then and/or a Concatenate and/or a Switch Block to define the variable based on the properties of the entity I am in currently and end up with
    VarX= "Related" + "Indications" + AgeGroupProperty + RoutetGivenProperty
    so that once the person is selected and route is selected it will then define which property to relate as VarX in in the lines of code for the related property.

    I do see an issue if say I want the " parenthesis character to show up as a character for VarX but I am sure there is ASCII code or some other way to define that character in code.

    Is it possible to define the relationship this way using a variable so that user input effects which Property they are selecting to choose from or interact with.



    Saturday, April 20, 2013 8:11 AM

Answers

  • LSML does not support this.


    Justin Anderson, LightSwitch Development Team

    • Proposed as answer by Paul Van Bladel Sunday, April 21, 2013 1:34 PM
    • Marked as answer by Angie Xu Tuesday, May 7, 2013 3:16 AM
    Sunday, April 21, 2013 9:16 AM
    Moderator

All replies

  • The model is a static definition of the structure of the application, so you cannot dynamically define what a navigation property is called or what association it uses.

    Justin Anderson, LightSwitch Development Team

    Saturday, April 20, 2013 9:00 PM
    Moderator
  • Ok I just thought the only reason it was static was because Parenthesis were used to define it as 'static text' instead of a 'number' or 'combination of characters' without parenthesis used to define a Var. A Var that would = some 'static text'. That maybe I could keep the code still linear by defining the Var first so that the next line of code would have it in a linear way.

    It is weird to me that code cannot handle this or is it just this part of .NET that cannot read a non-quoted 'pointer'. Say would a native SQL Database not in Silverlight be able to handle that?
    • Edited by reigh7 Saturday, April 20, 2013 9:31 PM
    Saturday, April 20, 2013 9:29 PM
  • It is weird to me that code cannot handle this or is it just this part of .NET that cannot read a non-quoted 'pointer'. Say would a native SQL Database not in Silverlight be able to handle that?
    The technologies involved do not have any limitation in this regard. The model just was not designed in such a way to allow for these types of notions.

    Justin Anderson, LightSwitch Development Team

    Saturday, April 20, 2013 9:41 PM
    Moderator
  • Ok so is there a model where I can write...

    //Properyt1 and Property2 are from the current entity

    VarW = "Related" + Property1
    VarX = Property1
    VarY = Property2
    VarZ = Property2 + "_" + Property1

    //Related Properties
    <EntityProperty Name=VarW
                            PropertyType=":String:">
         <EntityProperty.Attributes>
              <MaxLength Value"255" />
         </EntityProperty.Attributes>
    </EntityProperty>

    //Navigation Properties
    <NavigationProperty Association=VarZ
                            FromEnd=VarY
                            Name=VarX
                            ToEnd=VarX




    • Edited by reigh7 Saturday, April 20, 2013 10:10 PM spelling grammar
    Saturday, April 20, 2013 10:01 PM
  • LSML does not support this.


    Justin Anderson, LightSwitch Development Team

    • Proposed as answer by Paul Van Bladel Sunday, April 21, 2013 1:34 PM
    • Marked as answer by Angie Xu Tuesday, May 7, 2013 3:16 AM
    Sunday, April 21, 2013 9:16 AM
    Moderator