Is it possible to Automap from multiple assemblies?
Is it possible to Automap from multiple assemblies?
I found some postings that indicate
AutoPersistanceModel.AddEntityAssembly()
might let me do this, but have been unable to make it work.
If this is possible, can anyone supply a code fragment that shows how to automap from multiple assemblies, or point me to an example that works?
Thanks,
-Tom Bushell
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by James Gregory on 19 Feb, 2010 08:52 PM
Yeah, that's always been an awkward thing to do; and as usual, as something that I don't personally do, it hasn't been high on the priority list as far as things to fix go.
I've just committed a fix, and if you're able to update to the latest source you'll be able to take advantage of it.
If you're unable to update, your best bet is to automap each assembly individually using
AutoMap.AssemblyOf<T>()
and adding them to theAutoMappings
collection in your configuration.Support Staff 3 Posted by James Gregory on 04 Mar, 2010 02:07 PM
Hey Tom, was this of any use?
4 Posted by Tom Bushell on 04 Mar, 2010 03:02 PM
Hey James,
Sorry for not getting back to you.
Just after you made the change, my project took an unexpected turn, and I didn't get a chance to try it.
I'll try to take a look today, and let you know how I make out.
Thanks,
-Tom
-----Original Message-----
From: James Gregory
[mailto:***@tenderapp.com]
Sent: Thursday, March 04, 2010 9:07 AM
To: ***@bic.com
Subject: Re: Is it possible to Automap from multiple assemblies? [Help
and guidance]
5 Posted by tbushell on 04 Mar, 2010 07:57 PM
James,
This seems to work fine. In the following fragment, "TestMap" is a class in another assembly (all the other classes are in the executing assembly).
The hardest part (for me) was figuring out how to specify the Assembly parameters, since I'd never worked with that part of System.Reflection before. I'd be interested in your suggestions on better ways to do this.
-Tom
Support Staff 6 Posted by James Gregory on 05 Mar, 2010 09:47 AM
There's a few ways to get an
Assembly
instance, but the easiest one that I've found (as long as the assembly is already referenced by your current project) is to just do:typeof(TestMap).Assembly
.James Gregory closed this discussion on 05 Mar, 2010 09:47 AM.