Hi
Still playing with nh 3.2 mapping by code and I am now stumbling
around trying to work out how to map a bag. I get the following
exception when making a call to BuildSessionFactory
Could not determine type for: Domain.Model.Entities.Actor,
Domain.Model, for columns: NHibernate.Mapping.Column(id)
This is what I am trying to achieve:-
<bag name="ActorList" cascade="all-delete-orphan">
<key column="MovieId" />
<one-to-many class="Actor"/>
</bag>
my Movie Mapping Class
public class MovieMapping : SubclassMapping<Movie>
{
public MovieMapping()
{
DiscriminatorValue("Movie");
Property(x => x.Director, x => x.NotNullable(true));
Bag(x => x.ActorList, bag =>
{
bag.Key(k => k.ForeignKey("MovieId"));
bag.Cascade(Cascade.All | Cascade.DeleteOrphans);
});
}
}
If I remark out the Bag then BuildSessionFactory is fine
My Actor Mapping Class
public class ActorMapping : ClassMapping<Actor>
{
public ActorMapping()
{
Id(x => x.Id, map => map.Generator(Generators.GuidComb));
Table("ActorRole");
Property(x => x.Name, x => x.NotNullable(true));
Property(x => x.Role, x => x.NotNullable(true));
}
}
My Actor Class
namespace Domain.Model.Entities
{
public class Actor : Entity
{
public virtual string Name { get; set; }
public virtual string Role { get; set; }
}
}
My base Entity Class
public abstract class Entity
{
public virtual Guid Id { get; protected set; }
}
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.