I have a class that has a many to one property defined as follows:
[NHMA.ManyToOne(Name = "TypeOfEvent", ClassType = typeof(EventType), Column="EventTypeId")]
public virtual EventType TypeOfEvent {get; set;}
Everytime I try to load the class using a simple query (just loading all of the events in the database) I get the following exception:
NHibernate.HibernateException : Creating a proxy instance failed
----> System.Reflection.AmbiguousMatchException : Ambiguous match found.
The Event table has a foreign key (EventTypeId) that relates to EventType table’s primary key EventTypeId. If I change the mapping to int everything works fine.
I realize this is probably a really simple thing, but googling around hasn’t helped. Help. Please.