Metadata or List of entities and fields available

Posts   
 
    
nw
User
Posts: 42
Joined: 09-Jun-2010
# Posted on: 15-Jun-2010 09:22:18   

Hi,

Are there any ways to query what are the available entities in the system and also its properties such as its fields etc?

For example, in the EF, all the metadata I require are available in the CSDL file and the framework provides access to them through the following:

context.MetadataWorkspace.GetItems(DataSpace.CSpace)

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 15-Jun-2010 09:48:43   

You may use the EntityType enum to get all availabe entity types.

foreach (var entityType in Enum.GetNames(typeof(EntityType)))

Then you may use each entityType to create an entity instance as follows:

    var myEntity = GeneralEntityFactory.Create(entityType);

And then you can explore the myEntity.Fields collection of EntityFields to get hold of its Fields/Properties.

nw
User
Posts: 42
Joined: 09-Jun-2010
# Posted on: 15-Jun-2010 09:56:04   

Thanks heaps!