Marc Marc - 1 year ago 77
C# Question

NHibernate EntityPersister get property info (access attribute)

I'm using the persister (

AbstractEntityPersister
/
SingleEntityTablePersister
) to get some information of the mapped entities in NHibernate (keys, types, column names, ...), but now I want to get the access attribute of a property tag of an entity mapping:

<property type="byte" name="NoExportarAHost" column="PRO_NOEXPORTARAHOST_BS" access="CustomAccessor, CustomLibrary" />


Really I only need to know if the attribute is set or not. Is there any way to get this?

Answer Source

I don't know if you can get this information from the persister. I had the problem that I wanted to know mapping details and I stopped using the metadata API because it was too high level.

Accessing the NHIbernate configuration provide much more mapping details.

foreach (var classMapping in configuration.ClassMappings)
{
  foreach (var property in classMapping.PropertyIterator)
  {
    Console.WriteLine("{0} access={1}",
      property.Name,
      property.PropertyAccessorName);
  }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download