Child Property Question

Child Property Question

Old forum URL: forums.lhotka.net/forums/t/10214.aspx


jlfernandezmiranda posted on Monday, March 28, 2011

Hi,

I want to know if I can check if a managed property has children properties using fieldmanager and reflection. I use CSLA 3.8

In Project Tracker Sample I add a childBO called ChildInfo (typeof businessBase)

<Serializable()> _
Public Class Project
    Inherits BusinessBase(Of Project)


....................................................
Here are existing props (ID,Name,Started,...)

....................................................

Private Shared ResourcesProperty As PropertyInfo(Of ProjectResources) = RegisterProperty(New PropertyInfo(Of ProjectResources)("Resources"))
    Public ReadOnly Property Resources() As ProjectResources
        Get
            If Not FieldManager.FieldExists(ResourcesProperty) Then
                LoadProperty(Of ProjectResources)(ResourcesProperty,    ProjectResources.NewProjectResources())
            End If
            Return GetProperty(Of ProjectResources)(ResourcesProperty)
        End Get
    End Property
 



    Private Shared ChildInfoProperty As PropertyInfo(Of ChildBO) = RegisterProperty(New PropertyInfo(Of ChildBo)("Info Aditional"))
    Public ReadOnly Property ChildInfo() As ChildBO
        Get
            If Not FieldManager.FieldExists(ChildInfoProperty) Then
                LoadProperty(Of ChildBO)(ChildInfoProperty,    ChildBO.NewChildBO)
            End If
            Return GetProperty(Of ChildBO)(ChildInfoProperty)
        End Get
    End Property
.......

End Class


My question is: How to check If prop has children?

Private Sub MonitorProps()

For Each prop As IPropertyInfo In FieldManager.GetRegisteredProperties

Here I want to check If prop has children so it should
return true if prop is  ChildInfo or Resources
and return false if prop is ID Started Ended Description


Next

End Sub

 

Thanks

 

 

 

 

 

Copyright (c) Marimer LLC