Print Page | Close Window

Navigational Properties MetaData

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3231
Printed Date: 28-Mar-2024 at 8:49am


Topic: Navigational Properties MetaData
Posted By: gregweb
Subject: Navigational Properties MetaData
Date Posted: 24-Jan-2012 at 8:59am
I have an Entity Class "Customer". I then create a metadata buddy class for Customer and use the MetaDataAttribute to connect the two.

I can then decorate the properties of the metadata class, and they are incorporated into the generated code as expected.

However, if I decorate a Navigational Property, the attributes are NOT incorporated into the generated code.

It appears that the code which transfers the attributes from the metadata class to the generated class skips Navigational properties.

Now, the question you may be thinking, why would anyone want to decorate a navigational property. The reason is that I need to set Display(AutogenerateField = true) for the property. This is used at runtime to create a data grid. There are other custom attributes used as well on the property to help generate the grid.

But I need the navigational property to be properly decorated for this to work.

Greg



Replies:
Posted By: DenisK
Date Posted: 24-Jan-2012 at 7:24pm
Hi Greg;

What version are you using?

I just tested this using the latest 6.1.5 and it works for both scalar and non-scalar navigation property. I can see the generated code incorporated the new DisplayAttribute.


Posted By: gregweb
Date Posted: 25-Jan-2012 at 12:56pm
Thanks, I retested, and it seems to be working OK now.

Greg



Print Page | Close Window