Hi Guys:
Thought I would start a new thread with a descriptive title so that it would be easier for others to find.
I have a few tables which have a column representing the user who has added a message, a company, etc.
Now I have some typed lists which I use to pull information from various tables in order to give me a datatable that I can use with a repeater.
In the current example I bring back all messages sent to a particular person. The problem is if the user who sent the message is no longer on the system it doesn't return the message sent (Which is not what I want. I want all messages returned regardless of whether or not the person who sent it still exists on the system).
I've found threads that mention obeyweakrelations but it doesn't seem to work for me and I was wondering why?
Here are the related threads:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1880
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1280
And here is the method:
public static DataTable GetMessagesSentToUser(Guid userID)
{
MessagesSentTypedList messagesSent = new MessagesSentTypedList();
DataAccessAdapter adapter = new DataAccessAdapter(CampaignManager.ContainerConnectionString);
IRelationPredicateBucket bucket = (IRelationPredicateBucket)messagesSent.GetRelationInfo();
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(MessageFieldIndex.DomainUserID, ComparisonOperator.Equal, userID));
ISortExpression sorter = new SortExpression(SortClauseFactory.Create(MessageFieldIndex.Added, SortOperator.Descending));
messagesSent.ObeyWeakRelations = true;
adapter.FetchTypedList(messagesSent.GetFieldsInfo(), messagesSent, bucket, 0, sorter, false);
return messagesSent;
}