OK, I solved my own problem apparently, but it's not that pretty. I
added an override class that looks like this:
public class ActivityMappingOverride :
IAutoMappingOverride<Activity>
{
public void Override(AutoMap<Activity> mapping)
{
mapping.UseCompositeId()
.WithKeyProperty(x => x.Id)
.WithKeyProperty(x => x.ActivityTypeId,
"ActivityType_id");
mapping.PropertiesMapped.Add(typeof(Activity).GetProperty
("Id"));
mapping.PropertiesMapped.Add(typeof(Activity).GetProperty
("ActivityTypeId"));
}
}
A couple things that look fishy:
1) I had to hardcode the column name of ActivityType_id, I wish I
could've said .WithKeyProperty(x => x.ActivityType) and have it figure
out that I want to use the id from ActivityType
2) I had to tell the mapping class that I already mapped the two
properties or it would make an Id() mapping for Id and a Map() mapping
for ActivityType_id when the automapper ran. The many-to-one is still
created though (which is good).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---