Hello all,

I have this interface:

public interface IBaseEntity : IEquatable<BaseEntity>
{
int Id { get; set; }
bool IsTransient { get; }
}

public interface IStatistic : IBaseEntity
{
string Name { get; }
bool Attack { get; }
int Value { get; }
}

implemented by this abstract class:

public abstract class Statistic : BaseEntity, IStatistic
{
public abstract string Name { get; }
public abstract bool Attack { get; }
public abstract int Value { get; }
}

This abstract class in derived in this class:

public class MyStat : Statistic
{
public override string Name
{
get { return "Hello"; }
}

public override bool Attack
{
get { return false; }
}

public override int Value
{
get { return 100; }
}
}

Using this mappings:

mapper.Class<Statistic>(cm =>
 {
 cm.Id(a => a.Id, idm =>
  {
  idm.Access(Accessor.Property);
  idm.Generator(Generators.Native);
  });

cm.Property(s => s.Name, pm => pm.Access(Accessor.ReadOnly));
cm.Property(s => s.Attack, pm => pm.Access(Accessor.ReadOnly));
cm.Property(s => s.Value, pm => pm.Access(Accessor.ReadOnly));
});

mapper.Class<Action>(cm =>
 {
 cm.Id(a => a.Id, idm =>
  {
  idm.Access(Accessor.Property);
  idm.Generator(Generators.Native);
  });

 cm.ManyToOne(a => a.Statistic, pm =>
 {
 pm.NotNullable(false);
 pm.Column("StatisticId");
 });
 });

and this code:

[Fact]
public void Test()
{
using (ISession session = SessionFactory.OpenSession())
{
session.Save(new MyStat());
session.Flush();
}
}

I have this error:

NHibernate.MappingException: No persister for: 
Emidee.CommonEntities.Tests.NHibernate.StatisticsInNHibernateTests+MyStat

How should I change my mappings to make this work?

Thanks in advance

Michael

-- 
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.

Reply via email to