This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I am new to LS 4.0 and Generics. I have created a LS model with approximately 70 tables. I now need to use these tables in a Telerik RadTree (hierarchical) control. Navigating the LS objects is straightforward for most of the operations I need to perform, however I was wondering if there is an easier way to navigate the LS data model without necessarily referencing the child tables directly. For instance, in table 1 (lets call it doors) I have a number of properties as well as the ability to get the list of associated hinges that door door can have (the hinges would be in table 2). Table 3 contains the color those hinges could be and so on. What I am looking to do is have a generic functon to pass the top level class, then recursively continue to navigate down to the lower classes. During this navigation, the associated node information (for the RadTree) would be created to populate the tree. Any suggestions would be greatly appreciated.
Thanks in advance,
Mike |
|
|
The closest built-in thing is probably the metadata assembly. If you know the association you want to traverse, you can use AssociationInfo.GetValue(Entity) to get its value or collection contents. See http://www.mindscapehq.com/documentation/lightspeed/Working-with-Metadata for more info. Another option is to add a standard property or method through the partial class, implemented appropriately for each entity type e.g. public interface IHierarchical { IList Children { get; } } partial class Door : IHierarchical { partial class Hinges : IHierarchical { Finally I don't know the Telerik tree control but in a WPF/Silverlight tree the HierarchicalDataTemplate allows you to specify the 'get children' function separately at each level -- perhaps your control has something similar? |
|