ECO Persistence Mapper per connection
The Enterprise Core Objects Persistence Mapper is a singleton which is used by all EcoSpace instances. It’s purpose is to load mapping information from the DB when your app starts and to cache it, improving performance. I needed a connection per client, all running within a single application. This was a problem because once the PMP is created its connection string is tied to a single database. So I had to come up with a new PersistenceMapperDynamicSharer component. It is used on the EcoSpace to specify the PMapper type; additionally you can specify a connection string to use. It works by dynamically creating a descendant class of your PersistenceMapperProvider at runtime, one for each connection string. public class PersistenceMapperDynamicSharer : PersistenceMapperSharer { static ReaderWriterLockSlim Locker = new ReaderWriterLockSlim(); static Dictionary < string , PersistenceMapperProvider > MapperProviders = new Dictionary < string , PersistenceMapperPr