IAutomappingConfiguration confusion
I tried recompiling my project with the latest build (1.0.0.677) and discovered that SubclassStrategy and IsComponentType have been deprecated. Instead, I need to implement IAutomappingConfiguration. When I checked into this interface, I discovered that it includes 14 members that need to be implemented. I further discovered that I apparently need to implement or override this interface in every single class in my domain model. One reason is that I have a Layer Supertype. If I implement this interface in the layer supertype, I would need to have "AbstractClassIsLayerSupertype()" return "true" for this entity. I would then need to override this method in everything that inherits from it to return "false". ( Note: I have several abstract classes within the domain model in addition to the layer supertype. )
Looking at the other members brings up other questions. For example, what should "GetDiscriminatorColumn()" return for tables that don't use a discriminator column? What if I just want to use the default value for the discriminator column name? I have similar questions about the other members of the interface. I checked the wiki, but didn't find any pointers on using this interface. Unless I'm missing something here, it seems that AutoMapping now requires far more configuration making it considerably less "automatic".
Please help. Thanks!
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by James Gregory on 17 May, 2010 04:48 PM
This will all be written up for the 1.1 release. Look at the Example.FirstAutomappingProject to see how to use the automapping configuration. You've got some serious misunderstandings going on.
How did you discover you need to implement this interface for every single class in your domain model? You need to implement it once, and then pass it to the AutoMap method, that's it. Besides, you don't even need to implement it directly; if you look at the example I mentioned, you'll see there's a
DefaultAutomappingConfiguration
that already implements all those methods using the default options and you just need to override any method that doesn't work the way you want it to.The automapper requires exactly the same amount of configuration it always has done, it's just that configuration has been extracted into an object rather than being built up on the AutoMap method chain. You're still welcome to use it the same way you always have, it's just depreciated.
As I said, I'll write all this up, but here's a basic example:
Before
In your Fluently.Configure call:
After
In your Fluently.Configure call:
In another file:
3 Posted by MylesRip on 17 May, 2010 05:38 PM
That makes a lot more sense! How I got the wrong idea was this:
I have now downloaded the source with the example which makes it all clear.
Sorry to waste your time like that. I'm blaming it on the fact that today's a Monday! :-S
Support Staff 4 Posted by James Gregory on 17 May, 2010 05:44 PM
No worries. I'm sure you won't be alone in this confusion, so at least now I can point people here ;)
I'll get the wiki updated in time for the 1.1 release, which should be some time this week.
James Gregory resolved this discussion on 17 May, 2010 05:44 PM.