pelton wrote:
My goal is to be able to, at runtime, determine the table that a given class is persisted to.
Well, it looks as though I can do this by keeping my Configuration object that I used to create a SessionFactory. (I'm not sure why SessionFactory or Session doesn't expose a Configuration property. Maybe it does, but I can't find it).
So, once I have a Configuration object, getting the table name is pretty simple:
Code:
NHibernate.Mapping.PersistentClass c = MyConfigurationObject.GetClassMapping(typeof(MyClass));
Console.WriteLine("Table Name: {0}", c.Table.Name);
Maybe there is an easier way to do this (like if Session or SessionFactory exposes the Configuration object used to build it)....
--Brian