Using FNH's ClassMaps instead of auto mapping

11 views
Skip to first unread message

Zihotki

unread,
Apr 4, 2010, 12:17:27 AM4/4/10
to S#arp Architecture
Hi,

I need to use ClassMaps instead of auto mapping because of legacy
database. But I don't see how to tune SharpArch to use them. I tried
to remove AutoPersistentModelGenerator and use the following code in
the InitializeNHibernateSession method:

var config = NHibernateSession.Init(webSessionStorage,
new[]
{"ApplicationConfiguration.Models.dll"}
);

Fluently.Configure(config)
.Mappings(m =>
{

m.FluentMappings.AddFromAssemblyOf<ConfigSchema>();
});

But I always get MappingException - "No persister for: ConfigSchema"
when trying to work with the ConfigSchema.

Has anyone tried to do this?

Zihotki

unread,
Apr 4, 2010, 2:08:09 PM4/4/10
to S#arp Architecture
I'm stupid, sorry. Just use the following code in the
AutoPersistentModelGenerator:

var mappings = new AutoPersistenceModel();

mappings.AddMappingsFromAssembly(typeof(ConfigVersionMap).Assembly);
return mappings;

Reply all
Reply to author
Forward
0 new messages