Print Page | Close Window

Determining Column Properties at Runtime

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=836
Printed Date: 24-Jan-2026 at 1:30am


Topic: Determining Column Properties at Runtime
Posted By: danielp37
Subject: Determining Column Properties at Runtime
Date Posted: 11-Jun-2008 at 7:38am
What would be the best way to determine which properties on a DEF Entity are for DB columns at runtime.  For example, we have object navigator that allows us to search for specific objects and navigate through their collections or links to other objects.  The navigator form must know what properties on each object are from the DB so that it can show them in the results grid but the user could search for any number of different objects so we need to be able to use reflection to get the list of properties to show, but I don't want to show custom properties in the grid, just the properties that are linked to DB columns. 

I see that most of the properties have the DBDataType attribute, but I would like to see if there is another easier way.

Thanks,

Dan



Replies:
Posted By: kimj
Date Posted: 11-Jun-2008 at 8:17am

In Beta1, probably the best way to accomplish this would be to use EntityColumn.GetEntityColumns for the entity type.  Entity columns are auto-generated into the factory classes for the entity properties defined in the CSDL. 

In Beta2, we now have an EntityMetadataStore, and a much improved EntityMetadata class, which has getters for most of the interesting metadata you'd want to retrieve.

Beta2 should be available by the end of this week. (Hopefully I haven't jinxed it!)

 




Print Page | Close Window