Hi all,
I am trying to perform what I can only describe as the reverse version of IN() using the Nhibernate Criteria..
Rather than saying the value stored in the property is in the list/collection X
I want to say, this value X (an ID) is in the list which is a property of the object.
Any help appreciated, I can try to explain better if this makes no sense.
EDIT Apologies to people, as I understand this doesn't make enough sense...
I have an Event item in my system which can have a list of Audience (items) which it applies to. If the admin wants to delete an Audience item I want to check that the item is not referenced by any events. (The AudienceList is stored as a string list of IDs for Audiences).
What I was thinking was something along the lines of:
var results = SessionInstance.Session.CreateCriteria(typeof(EventItem.Items.EventItem)) .Add(Restrictions.In("AudienceList", myAudience.ID)) .List();
But I need the AudienceList and myAudience.ID to be the other way around don't I? I have the audience ID but need to check that it might be in a list of other ids.
Thanks again.
EDIT 2
The definition of the EventItem is such that one of it's properties is a DetailCollection of Audience IDs, they are saved to the DB as a string list of IDs.