I have 2 classes with the following setup:
[ActiveRecord("ReceivedMessage")]
class ARReceivedMessage : ARBase<ARReceivedMessage>
and:
[ActiveRecord("ReceivedMessageReply")]
class ARReceivedMessageReply : ARBase<ARReceivedMessageReply>
[BelongsTo(Type = typeof(ARReceivedMessage), Column = "ReceivedMessageID")]
public ARReceivedMessage Message { get; set; }
When trying to clean up the database i first want to delete all the ReceivedMessageReply objects before deleting the ReceivedMessage itself. In code this brought me to the following:
Get all receivedMessages i want to delete:
ARReceivedMessage[] messagesToDelete = ARReceivedMessage.GetAll(messageCriterion);
Get the criterion for deleting all ReceivedMessageReplys and delete them:
ICriterion relatedCriterion = Restrictions.In("ReceivedMessageID", messagesToDelete);
ARReceivedMessageReply.DeleteAll(relatedCriterion);
Somehow activerecord tells me the following: could not resolve property: ReceivedMessageID of: ARReceivedMessageReply
Any idea where im making a mistake?
Thanks in advance
Somehow i had to use the following:
ICriterion relatedCriterion = Restrictions.In("Message", messagesToDelete);
So not the columnname/propertyname set by activerecord, but the property name itself. This was unexpected...