gpt4 book ai didi

Nhibernate Conformist 映射 "Unable to determine type..."

转载 作者:行者123 更新时间:2023-12-03 12:53:44 24 4
gpt4 key购买 nike

类:

    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; }
}

映射:
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);
});
}
}

错误:

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



我希望它很简单,这是我使用 Conformist 映射的第一个项目,所以也许我只是忽略了一些东西。

最佳答案

来自我们对 nhusers 邮件列表的讨论。

我遇到了同样的问题。

您尚未定义关系类型。请参阅行 action => action.OneToMany());在下面的映射中。

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);
}
}

关于Nhibernate Conformist 映射 "Unable to determine type...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7339463/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com