joshg wrote:
hi i tried using query spec once, but it didn't work at all. I think I had to regenerate the source code, and do a whole lot of other stuff.
You don't have to regenerate code in order to user QuerySpec. If you show us your code we can try to help you on that.
joshg wrote:
So i can't do it using a typed list, period?
Yes, you can. The thing is: what relation do you want to change and how to identify that relation you want to change. Here is a little example. I have a relation on my typedList: Order->Shipper. In the Designer the join hint is LEFT. Here I change it to INNER:
[TestMethod]
public void ChangeJoinHintOfTypedList()
{
var typedList = new SalesTypedList();
// filters, etc
var bucket = typedList.GetRelationInfo();
bucket.PredicateExpression.Add(OrderFields.OrderDate <= DateTime.Now);
// replace the join hint
foreach (IRelation rel in bucket.Relations)
{
// find the appropriate relation
if ((rel.HintTargetNameLeftOperand == EntityType.OrderEntity.ToString() && rel.HintTargetNameRightOperand == EntityType.ShipperEntity.ToString())
|| (rel.HintTargetNameLeftOperand == EntityType.ShipperEntity.ToString() && rel.HintTargetNameRightOperand == EntityType.OrderEntity.ToString()))
{
((EntityRelation)rel).HintForJoins = JoinHint.Inner;
}
}
// fetch
using (var adapter = new DataAccessAdapter())
{
adapter.FetchTypedList(typedList.GetFieldsInfo(), typedList, bucket, 0, null, true);
}
}
Note that above I find the relation by comparing it's start entity type to the end entity type. This won't work, possibly, if you have more than one relation with the same ends types.