开发者

Nhibernate Conformist Mapping "Unable to determine type..."

The class:

    public class SOPProcess : ISOPProcess
{
    public virtual Guid Id { get; set; }
    public virtual SOP SOP { get; set; }
    public virtual ProcessType Type { get; set; }       

    public virtual SOPProcessInput Input { get; set; }
    public virtual SOPProcessOutput Output { get; set; }
    public virtual SOPProcessMeasures Measures { get; set; }

    public virtual decimal YieldFactor { get; set; }

    public virtual SOPProcess PreviousProcess { get; set; }
    public virtual SOPProcess NextProcess { get; set; }
}

The Mapping:

public class SOPProcessMap : ClassMapping<SOPProcess>
{
    public SOPProcessMap()
    {
        Id(s => s.Id, i => i.Generator(Generators.GuidComb));

        Property(s => s.YieldFactor);           

        ManyToOne(s => s.SOP, m =>
                                {
                                    m.Column("SopId");
                                    m.Cascade(Cascade.All);
                                });

        ManyToOne(s => s.Type, m =>
                                {
                                    m.Column("ProcessTypeId");
                                    m.Cascade(Cascade.All);
                                });

        ManyToOne(s => s.NextProcess, m =>
                                        {
                                            m.Column("NextProcessId");
                                            m.Cascade(Cascade.All);
                                        });

        ManyToOne(s => s.PreviousProcess, m =>
                                            {
                                                m.Column("PreviousProcessId");
                                                m.Cascade(Cascade.All);
                                            });
    }
}

The Error:

NHibernat开发者_StackOverflowe.MappingException: Could not determine type for: MES.ProcessManager.SOP.SOPProcess, MES.ProcessManager, for columns: NHibernate.Mapping.Column(id)

I hope it's something simple, this is my first project using the Conformist mapping, so maybe I'm just overlooking something.


From our discussion on the nhusers mailing list.

I ran across the same problems.

You haven't defined the type of relationship. See the line action => action.OneToMany()); in the mapping below.

public class SportMap : ClassMapping<Sport>
{
    public SportMap()
    {
        Id(x => x.Id, map =>
        {
            map.Column("Id");
            map.Generator(Generators.GuidComb);
        });

        Property(x => x.Name, map =>
        {
            map.NotNullable(true);
            map.Length(50);
        });

        Bag(x => x.Positions, map =>
        {
            map.Key(k => k.Column(col => col.Name("SportId")));
            map.Cascade(Cascade.All | Cascade.DeleteOrphans);
        },
        action => action.OneToMany());

        Property(x => x.CreateDate);
        Property(x => x.CreateUser);
        Property(x => x.LastUpdateDate);
        Property(x => x.LastUpdateUser);
    }
}


It turned out that the problem was in my Set mappings in other classes. If you don't specify the action for the mapping, it throws this (misleading) error.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜