0
votes

I have the class filter.cs with this attributes:

    public virtual int Id { get; set; }
    public virtual Attribute Attribute { get; set; }
    public virtual Int16 Type { get; set; }
    public virtual string FilterValue { get; set; }
    public virtual ReportConfiguration ReportConfiguration { get; set; }

Attribute and ReportConfiguration are a Foreign Key.

I made this mapping:

        Id(a => a.Id).UnsavedValue(0).GeneratedBy.Identity();
        Map(a => a.Type);
        Map(a => a.FilterValue);
        References(x => x.ReportConfiguration).Column("IdReportConfiguration").Not.LazyLoad();
        References(x => x.Attribute).Column("IdAttribute").Not.LazyLoad();

In addition, I have a Repository class for example with the method:

public int Create(Filter F)
    {
        int FilterId = 0;
        Transactional(session =>
        {
            FilterId = (int)session.Save(F);
        });
        return FilterId;
    }

And when I did the Unit Test of Create(Filter F) it produced an exception:

No persister for: ....Filter.cs

I think the mapping is not correct.

Any idea?

Thanks and best regards.

1

1 Answers

0
votes

Try here:

Fluent Nhibernate No persister for:

From the above post:

Solution: This error occurs since the class is not public. Just change the class to public and this won't occur again. However, if you do not want to expose the assembly outside the Assembly you can still mark the constructor as 'internal'.

Is this your situation?


This is a similar question:

Fluent Nhibernate No Persistor for Class Name