Many-To-Many

A Many-to-Many like the Zero-to-Many uses a collection to represent the nested sub-object. There are two new methods on a Many-To-Many and they are Associate and Dissociate. EntitySpaces implements the Many-to-Many in such a way that you never actually see the linking table. However, there are EntitySpaces objects for the linking table, they are just hidden away to make your life easier.

In this example we are going to loop through all of the Territories for a given Employee. Behind the scenes there is set of EntitySpaces classes to represent the EmployeeTerritories table however they are not exposed though the programmer can use them at will whenever desired.

C#
VB

You can also associate and dissociate Territories as follows.

C#
VB