When you say 'won't map both', what do you mean exactly? What happens to the
xml when you include both derived classes?

On Tue, Feb 16, 2010 at 1:47 AM, Kenneth Cochran
<kenneth.coch...@gmail.com>wrote:

> I have two classes in separate, dynamically loaded assemblies that
> both inherit from the base class TaxForm. Here is the configuration
> for the Automapper:
>
>                    .Mappings(m =>
>                                  {
>                                      foreach (Assembly assembly in
> DomainAssemblies)
>                                      {
>
> m.AutoMappings.Add(AutoMap.Assembly(assembly)
>                                              .Where(t =>
> t.Namespace.EndsWith("Domain"))
>                                              .Conventions.Add(new
> UseNativeGeneratorConvention())
>                                              .Conventions.Add(new
> CascadeAll())
>                                              .Override<TaxForm>(map
> => map.IgnoreProperty(x => x.SupportedFilingMethods))
>                                              .Override<TaxForm>(map
> => map.IgnoreProperty(x => x.Name))
>                                              .Override<TaxForm>(map
> => map.IgnoreProperty(x => x.Agency))
>                                              .Setup(s =>
> s.IsComponentType = type => type.GetInterface("IValueObject") !=
> null));
>                                      }
>                                  })
>
> Now when I create a schema with only the base class and one of the
> child classes(doesn't seem to matter which one) everything works fine.
> But when I add another descendant of TaxForm, Automapper won't map
> both.
>
> I've stepped through the code and can say for certain that both
> assemblies are loaded and in the DomainAssemblies collection.
>
> TaxForm WAS an abstract class but I kept getting errors that
> NHibernate was trying to instantiate it. The only solution I could
> that would work was to change it to a concrete class. This is unlikely
> to be the cause of the current problem, which has existed long before
> NHibernate started complaining about instantiating abstract classes.
>
> Any help would be appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibern...@googlegroups.com.
> To unsubscribe from this group, send email to
> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to