I'm new to both NHibernate and the fluent API. I'm attempting to
iterate through a list of assemblies, automapping each one. Then I
want to load the mappings into a configuration. All the examples I've
come accross show automapping a single assembly inline. This would
work if I knew the assemblies at design time. I could just use method
chaining to map each one.
For doing a mapping a single assembly I have the following:
var fb = new FirebirdConfiguration();
var configuration = Fluently.Configure()
.Database(fb)
.Mappings(m => m.AutoMappings.Add(AutoMap
.Assembly(myAssembly)
.Where(t => t.GetInterface("IEntity")!= null));
But the assemblies I'm attempting to map are plugins, which may or may
not be present in a production environment. I'm pretty sure it should
look something like:
foreach( var assembly in assemblies)
{
myMappings.Add(AutoMap.Assembly(assembly).Where(t => t.GetInterface
("IEntity") != null)));
}
var fb = new FirebirdConfiguration();
var configuration = Fluently.Configure()
.Database(fb)
.Mappings(myMappings);
For the life of me I can't figure it out. If its not to much trouble
could someone post some example code on how to do this?
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en.