The automapper isn't smart enough to determine whether your interface
should be mapped or not. In this case the interface needs to be mapped
because your entities have properties that use IEmployer and
IEmployee. However the automapper cannot assume that all interfaces
that your domain classes inherit from should be mapped (for example,
you wouldn't want IComparable mapped). I believe its theoretically
possible to make the automapper smart enough to figure this out, but
it would be non-trivial.

On Sat, Jan 9, 2010 at 2:24 AM, ksc654 <[email protected]> wrote:
> I typed this simplified example without the benefit of an IDE so
> forgive any syntax errors.
> When I try to automap this I get a FluentConfigurationException -
> "Association references unmapped class IEmployee."
> I'm not opposed to creating a ClassMap manually but I prefer
> AutoMapper doing it instead.
>
> public interface IEmployer
> {
>  int Id{ get; set; }
>  IList<IEmployee> Employees { get; set; }
> }
>
> public class Employer: IEmployer
> {
>  public int Id{ get; set; }
>  public IList<IEmployer> Employees { get; set; }
>
>  public Employer()
>  {
>    Employees = new List<IEmployee>();
>  }
>
> }
>
> public interface IEmployee
> {
>  int Id { get; set; }
>  IEmployer Employer { get; set; }
> }
>
> public class Employee: IEmployee
> {
>  public int Id { get; set;}
>  public IEmployer Employer { get; set;}
>
>  public Employee(IEmployer employer)
>  {
>    Employer = employer;
>  }
> }
>
> --
> 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.
>
>
>
>
-- 
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.


Reply via email to