by linqToSql i want to return objects which have in theirs xml property ActivityId, one of ID from another collection which stores same kind of objects which i want to return. If i dont have collection to compare but single object i use for example something like this:
string activity = String.Format("name=\"activityId\" value=\"{0}\"", value);
var activities = DbContext.Activities.Where(x => x.XmlData.ToString().Contains(activity)
And thats works, but now i need to put as variable "activity" list of strings not single string and that became problem. So for bether explain ill give more info:
I have such data ( pseudo code ):
Class Activity{
int Id;
byte Type;
XElement XmlData;
}
"Type" property in this class means kind of activity which was made. in "XmlData" property i'm storing data like that:
<data>
<property name="activityId" value="10" />
<property name="commentId" value="1" />
</data>
in another query ( lets name it "Query1", i've got collections of activities, for example Activities.ID = 1,2,3,4,5
now i want to get collection of Activities which will contain in XmlData "activityId", id from Query1.
something simmilar of that what i want to get is:
var activities = new List<string>();
pictureActivities.ToList().ForEach(x=> activities.Add(String.Format("name=\"activityId\" value=\"{0}\"", x.Id)));
var commentActivities = DbContext.Activities.Where(x => x.Type == 18 && x.XmlData.ToString().Contains(activities.Any()));
I hope you understand what im trying to achieve. Thanks for help.
No comments:
Post a Comment