Yo
i have the following nhibernate class:
public class User
{
public virtual int Id { get; set; }
public virtual string FullName { get; set; }
public virtual IList<RatingItem> RatingItems { get; set; }
public User()
{
RatingItems = new List<RatingItem>();
}
public virtual void AddRatingItems(RatingItem ratingItem)
{
ratingItem.User = this;
RatingItems.Add(ratingItem);
}
}
and the following fluent mapping:
public class UserMap : ClassMap<User>
{
public UserMap() {
Id(x=>x.Id);
Map(x=>x.FullName);
HasMany(x=> x.RatingItems).Inverse().Cascade.All();
}
}
rating item has similar except it sees the user object like this:
public virtual User User { get; set; }
and the mapping file has this:
References(x => x.User);
however - when i try to load a user object and get then ask for its RatingItems - i get the following error:
could not initialize a collection: [IsItGd.Model.Entities.User.RatingItems#1]
anyone?
:)
w://