我有 2 个具有以下设置的课程:
[ActiveRecord("ReceivedMessage")]
class ARReceivedMessage : ARBase<ARReceivedMessage>
和:
[ActiveRecord("ReceivedMessageReply")]
class ARReceivedMessageReply : ARBase<ARReceivedMessageReply>
[BelongsTo(Type = typeof(ARReceivedMessage), Column = "ReceivedMessageID")]
public ARReceivedMessage Message { get; set; }
在尝试清理数据库时,我首先要删除所有 ReceivedMessageReply 对象,然后再删除 ReceivedMessage 本身。在代码中,这使我想到了以下内容:
获取我要删除的所有收到的消息:
ARReceivedMessage[] messagesToDelete = ARReceivedMessage.GetAll(messageCriterion);
获取删除所有 ReceivedMessageReplys 的标准并删除它们:
ICriterion relatedCriterion = Restrictions.In("ReceivedMessageID", messagesToDelete);
ARReceivedMessageReply.DeleteAll(relatedCriterion);
不知何故,activerecord告诉我以下内容:无法解析属性:ReceivedMessageID of:ARReceivedMessageReply
知道我在哪里犯了错误吗?
提前致谢