Retrieving OutputSettingValues for Relation in lpt

Posts   
 
    
ww
User
Posts: 83
Joined: 01-Oct-2004
# Posted on: 17-Jun-2011 19:54:30   

I have an lpt template in which I'm trying to retrieve a setting value for a Relation. So I've got a NormalRelationshipEdge and I'm trying to get to OutputSettingValues.GetRealBoolSettingValue, but OutputSettingValues isn't a member for NormalRelationshipEdge. I can't figure out how to get to the settings from here.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jun-2011 22:34:28   

Are you sure you want to retrieve a setting for a relation? Relations don't have output setting values. Navigators do have OutputSettingValues, but no settings, just Custom Properties and Attributes. What is the real setting you are trying to retrieve? Could you show me a snapshot?

David Elizondo | LLBLGen Support Team
ww
User
Posts: 83
Joined: 01-Oct-2004
# Posted on: 17-Jun-2011 23:05:38   

Sorry, yes--navigator. I defined some custom settings in the frameworksettings file. In the Designer, I edit the entity, go to Code Gen Info, and select one of my relation navigators. I can then edit the output settings on the "Setting Values" tab.

I just realized that I need to call the Get*NavigatorAsObject method to get the navigator, then get the OutputSettingValues. What's the easiest way to work out which side of the relation I am on, to know whether to look at Start or End?

I used GetAllRelationshipsForEntity to get the relationships. I guess I'm looking for the easiest equivalent to "Foreach RelatedEntity" in TDL.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-Jun-2011 00:14:29   

Here is an example of how I would iterate the relations, pick the start navigator and ask for the setting:

var relationships = _currentProject.GetAllRelationshipsForEntity(entity, true);
foreach (var rel in relationships)
{
    var navigator = rel.GetStartNavigatorAsObject();
    string mySetting = navigator.GetRealStringSettingValue("mySettingName", _currentProject);   
}
David Elizondo | LLBLGen Support Team