I have problems generating a new table by using HasManyToMany only When I
have a IDictonary as a source, for instance If I try it with an IList I do
not have any problem and I see how a new table is generated and the
relations. But I need to use a IDictioonary
The example:
public class Email: I_CLASS
{
public virtual int Id { get; set; }
public virtual IDictionary<Person, short> Destiny_Persons { get; set; }
}
public class Person: I_CLASS
{
public virtual int Id { get; set; }
}
class Notification_DTO_Map : IAutoMappingOverride<Notification_DTO>
{
public void Override(AutoMapping<Notification_DTO> mapping)
{
mapping.HasManyToMany<User_DTO>(x =>
x.Destiny_Users).Table("Destiny_Persons")
.ParentKeyColumn("Email")
.ChildKeyColumn("Person")
.AsEntityMap().Element("Email_Status", part =>
part.Type<short>());
}
}
my target is to have that dictionary and a new table called Destiny_Persons
with the followinf attributtes:
- Person_Id (int) PK FK
- Email_Id (int) PK FK
- Status (short) not null
The status won´t be part of the PK
If a use a IList like this public virtual IList<Person> Destiny_Persons {
get; set; }
and in the mapping: mapping.HasManyToMany(x =>
x.Destiny_Persons ).Table("Destiny_Persons");
this works without the Status attributte
I have tried a lot of different ways of putting this such as changing the
order of the elements in the dictionary <short, Person>, using asMap
instead of AsEntityMap, not using partenkeycolums and child, changing the
order... and so on
I do not have any error when I generate the database but I am not able to
generate the table Destiny_Persons when I have a IDictionary as a source
Thanks
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.