具有相同标识符值的另一个对象已与以下会话相关联:实体的以下会话:1,Database.Entities.ItemModel

时间:2019-07-03 14:19:07

标签: c# nhibernate fluent-nhibernate

具有相同标识符值的另一个对象已经与  会话: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服务器中的另一个客户端时,我收到此错误

0 个答案:

没有答案