with smooth nhibernate, is there a way to dynamically switch the mapping table at runtime?
For instance:
public class XYClassMap : ClassMap<XY>
{
public XYClassMap( )
{
Table("XYTable");
Id(d => d.Id).GeneratedBy.Identity();
Map(d => d.Value);
(...)
Given that there are several plugins, each of them uses this one class, but they need to work with different tables. I am looking for something like this:
public class XY {
public string Tablename {get; set;}
}
public class XYClassMap : ClassMap<XY>
{
public XYClassMap( )
{
Table(Tablename);
Id(d => d.Id).GeneratedBy.Identity();
Map(d => d.Value);
(...)
Thus, each action method can work with the same class, and only he will need to set this property to “Table Name”.
Thanks for any help
Steffen
source
share