具有相同标识符值的另一个对象已经与 会话:1,实体:Database.Entities.ItemModel
using (var session = Server.DatabaseSessionFactory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
var report = new CharacterReportModel
{
Category = category,
Reason = ReportReason.Get(category),
Description = description,
CreatedAt = DateTime.Now,
ReportedBy = user.Character,
Character = client.Character
};
client.Character.Reports.Add(report);
session.SaveOrUpdate(report);
transaction.Commit();
}
}
HasMany(x => x.Reports).KeyColumn(“ Character_ID”)。Inverse()。Cascade.SaveUpdate();
ReportedBy = user.Character, 角色= client.Character
当客户端报告mmo服务器中的另一个客户端时,我收到此错误