Re: How to get table name for a simple bag?

12 views
Skip to first unread message

Ricardo Peres

unread,
Aug 10, 2012, 5:44:18 PM8/10/12
to nhu...@googlegroups.com
Try this:
 

On Thursday, August 9, 2012 3:29:39 PM UTC+1, Freeman wrote:

Having a bag mapped like this:

<bag name="Addresses" table="address" cascade="all-delete-orphan">
  <key column="employee"/>
  <element column="address"/>
</bag>

How can I get at runtime the table name in which the addresses are stored?

If the collections generic type was a NHibernate mapped class I could have done it like this:

var tableName = (sessionFactory.GetClassMetadata(itemType) as SingleTableEntityPersister).TableName;

But in this case the collections generic type is just a string and I couldn't find any way to retrieve the table name from the metadata.

original question: http://stackoverflow.com/q/11885054/750216

Thank you!
Reply all
Reply to author
Forward
0 new messages