views:

14

answers:

1

So, you can use NHibernate.ISessionFactory.GetClassMetadata(System.Type) to get information about a mapped entity class in NHibernate.

However when the type is mapped as a component, GetClassMetadata blows up with an exception stating that the class is not an entity.

Is there a way to retrieve metadata information about a mapped component and its properties?

+1  A: 

You need to get the metadata for the class that contains the component, which will be one of the properties.

Diego Mijelshon
Diego, I realize that I can get information about the component property itself, but I'm not seeing a way to "dig into" the component and find out about *its* properties.
Alex Beynenson
If you check the `IType` of the Component property and `IsComponentType` is true, you can cast it as `IAbstractComponentType` and get all its information easily.
Diego Mijelshon