I have an class with an IDictionary on it.
I have a working example, this should make it clear to you.
Classes:
public class Customer : Entity
{
public IDictionary FavouriteBooks { get; set; }
}
public class Book : Entity
{
public string Name { get; set; }
}
And then the map:
HasManyToMany(x => x.FavouriteBooks)
.Table("FavouriteBooks")
.ParentKeyColumn("CustomerID")
.ChildKeyColumn("BookID")
.AsMap("Nickname")
.Cascade.All();
Resulting xml:
Generated SQL:
create table "Customer" (
"Id" integer,
"FirstName" TEXT,
primary key ("Id")
)
create table FavouriteBooks (
"CustomerID" INTEGER not null,
"BookID" INTEGER not null,
"Nickname" TEXT not null,
primary key ("CustomerID", "Nickname")
)
create table "Book" (
"Id" integer,
"Name" TEXT,
primary key ("Id")
)