NHibernate: How to-reconfigure mappings at runtime?
Posted
by George Mauer
on Stack Overflow
See other posts from Stack Overflow
or by George Mauer
Published on 2010-03-26T19:56:45Z
Indexed on
2010/03/26
20:13 UTC
Read the original article
Hit count: 131
nhibernate
|.NET
Let's get this out of the way first: I know that SessionFactory is immutable - I'm trying to change the Configuration at runtime and regenerate ISessionFactory.
Specifically, I have a Customer mapped that will have some fields added to its dynamic-component node at runtime. I would like to do something like this
var newSessionFactory = previousConfiguration
.RemoveClassMapping(typeof(Customer))
.AddXmlString(newMappingForCustomer)
.BuildSessionFactory();
However, I don't see any obvious way to remove a mapping, is there anything I can do short of regenerating the entire Configuration?
© Stack Overflow or respective owner