views:

158

answers:

0

I have three tables:

Employee, EmployeesCustomer, and Customer.

Employee has a primary key called Id.
Customer has a primary key called Id.
EmployeesCustomer has a composite key made up of two fields, EmployeeId and CustomerId. The EmployeesCustomer does NOT contain any other fields.

My goal is to create an IDictionary on the Employee. The key will be the Customer's Id, and the value will be the Customer object pertaining to that Id.

I figured the Employee mapping should look like this:

HasManyToMany<Customer>(x => x.CustomerIDictionary)  
    .AsMap<int>("CustomerId")  
    .Table("EmployeesCustomer")  
    .ParentKeyColumn("EmployeeId")  
    .ChildKeyColumn("CustomerId")  
    .Not.LazyLoad();

This will throw an error about having an existing mapping. I know how to create a dictionary mapping for a HasMany and a HasManyToMany with more than two fields but I can't figure anything out for this.

Is this scenario even possible?