PropertyDescriptor from EntityView2 returns null

Posts   
 
    
tomahawk
User
Posts: 169
Joined: 02-Mar-2005
# Posted on: 25-Sep-2008 22:52:03   

LLBLGen Runtime Libs 2.6.08.0911 Adapter

I am using my DAL library with a DevExpress grid for WPF. I have a ClientAccountEntity class that references a ContactEntity with the property Contact. With databinding I'm unable to access the Contact property, as DevExpress tells me the property descriptor for this property returns null.

Here is the thread from DevExpress:

Hi Josh,

Thank you for your test project. We see the problem.

There is a SD.LLBLGen.Pro.ORMSupportClasses.EntityView2 class that is used as the grid's data source. It implements the ITypedList interface, so the grid's data controller gets property descriptors via the ITypedList.GetProperties method. However, there is no "Contact" property in the list:


            SD.LLBLGen.Pro.ORMSupportClasses.EntityView2<ClientAccountEntity> list = new SD.LLBLGen.Pro.ORMSupportClasses.EntityView2<ClientAccountEntity>(new EntityCollection<ClientAccountEntity>());
            PropertyDescriptor fromList = list.GetItemProperties(null)["Contact"]; // fromList == null
            PropertyDescriptor fromType = TypeDescriptor.GetProperties(typeof(ClientAccountEntity))["Contact"]; // fromType != null

Thanks, Nick

Do you have any recommendation as to why this is not working, or a suggestion as to how I should reply to this thread for more information?

Thanks, -Josh

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Sep-2008 14:03:10   

They're correct, the property is annotated with a Browsable(false) attribute, which makes it hidden for ITypedList.

To enable this, go to the Project properties, and set the property "HideManyOneToOneRelatedEntityPropertiesFromDatabinding" to false (it's true by default). It's under the task performers section.

Then re-generate the code.

be aware of the fact that this action will remove all Browsable(false) attributes on fields mapped onto m:1/1:1 relations in the code, so they'll all show up as columns in grids etc. This then will force you to remove these columns if you auto-retrieve the column info. So if you don't want to do that either, add a property in code which simply gets/sets the original Contact property but doesn't have a Browsable(false) attribute simple_smile

Frans Bouma | Lead developer LLBLGen Pro
tomahawk
User
Posts: 169
Joined: 02-Mar-2005
# Posted on: 27-Sep-2008 00:54:51   

Thanks, that worked!