Relf-reference using OA

2 posts, 0 answers
  1. Ubuntu
    Ubuntu avatar
    89 posts
    Member since:
    Jul 2012

    Posted 20 Apr 2011 Link to this post

    Dear All,
    I have the following implementation for treeview using EF4, I tried to do the same using OA but with no luck, here we go:
    On EF4 dmx diagram I have the following setting for my group table:
    Parent: 0..1 (Zero or One)
    Children: * (Many)
    which are define as association on the group table.

    I then have this xaml for the itemtemplate
        <telerik:HierarchicalDataTemplate x:Name="ItemTemplate" ItemsSource="{Binding Children}">
        <Grid>
            <Grid.ColumnDefinitions>
            <ColumnDefinition Width="16"/>
            <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock x:Name="Label" Text="{Binding groupname}" Grid.Column="1"/>
        </Grid>
    </telerik:HierarchicalDataTemplate>
    Also this is the treeview xaml showing the binding to the groupcollection
    <telerik:RadTreeView x:Name="Treeofgroups" FontSize="11" Grid.Row="1"
        IsLineEnabled ="True"
        ItemTemplate="{StaticResource ItemTemplate}" 
        IsLoadOnDemandEnabled="True"
        LoadOnDemand="ItemExpanded"
        SelectedItem="{Binding CurrentSelected,Mode=TwoWay}"
        ItemsSource="{Binding GroupCollection,Mode=TwoWay}"         
    </telerik:RadTreeView>

    In my ViewModel I have a QueryableDomainServiceCollectionView<group> GroupCollection to hold the list of groups from the domainservice using the following method on the domainservice:
    public IQueryable<group> Getgroups()
    {
        return this.ObjectContext.group.Include("Children").Where(p => p.parentid == null || p.parentid == "");
    }

    I also have this method to get the subgroups when the treeview get expanded (loaded Ondemand);
    public IQueryable<group> GetChildrenByParentID(string parentID)
    {
        return this.ObjectContext.group.Include("Children").Where(p => p.parentid == parentID);
    }

    I can't do the same implementation on the OA domainservice.

    How can I achieve this scenario in treeview & OA
    .

    Best regards





  2. Ubuntu
    Ubuntu avatar
    89 posts
    Member since:
    Jul 2012

    Posted 20 Apr 2011 Link to this post

    Dear All,

    Never mind, I mange to get it to work.
    I just removed the .Include("Children") and everything else is just fine.

    Best
  3. DevCraft banner
Back to Top