Viele zu Viele Beziehung mit Fluent NHibernate

Ich bin immer folgende Fehlermeldung: "Kann nicht herausfinden, was die andere Seite einer viele-zu-viele-sein sollte."
Team Organisation:

public class Team : IEntity
{
    public int Id { get; set; }

    public string Name { get; set; }

    public IList<Employee> Employee { get; set; }

    public Team()
    {
        Employee = new List<Employee>();
    }
}

Employee-Entität:

public class Employee : IEntity
{
    public int Id { get; set; }

    public String LastName { get; set; }

    public string FirstName { get; set; }

    public IList<Team> Team { get; set; }

    public string EMail { get; set; }

    public Employee()
    {
        Team = new List<Team>();
    }
}

Team mapping:

public class TeamMap : ClassMap<Team>
{
    public TeamMap()
    {
        //identity mapping
        Id(p => p.Id);

        //column mapping
        Map(p => p.Name);

        //relationship mapping
        HasManyToMany<Employee>(m => m.Employee);
    }
}

Mitarbeiter-Zuordnung:

public class EmployeeMap : ClassMap<Employee>
{
    public EmployeeMap()
    {
        //identifier mapping
        Id(p => p.Id);

        //column mapping
        Map(p => p.EMail);
        Map(p => p.LastName);
        Map(p => p.FirstName);

        //relationship mapping
        HasManyToMany<Team>(m => m.Team);
    }
}

Niemand hat eine Antwort?

Edit: Der Fehler tritt auf folgenden code:

public static ISessionFactory CreateSessionFactory()
{
    return Fluently.Configure()
        .Database(MsSqlConfiguration.MsSql2008
        .ConnectionString(c=>
            c.Database("Ariha")
            .TrustedConnection()
            .Server("localhost")
            ).ShowSql())
        .Mappings(m => m.FluentMappings
            .AddFromAssemblyOf<BookMap>()
            .AddFromAssemblyOf<MagazineMap>()
            .AddFromAssemblyOf<EmployeeMap>()
            .AddFromAssemblyOf<TeamMap>())
        .ExposeConfiguration(BuildSchema)
        .BuildSessionFactory();
}

edit: hier die ganze Lösung: http://rapidshare.com/files/309653409/S.O.L.I.D.Ariha.rar.html

InformationsquelleAutor Rookian | 2009-11-18
Schreibe einen Kommentar