erichar11 wrote:
First attempt at overriding the dataaccessadapter method for FetchEntity. I create a relationpredicatebucket but I can't figure out how to apply that to the the entityToFetch.
public override bool FetchEntity(SD.LLBLGen.Pro.ORMSupportClasses.IEntity2 entityToFetch)
{
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(entityToFetch.Field["CompanyId"],ComparisonOperator.Equal, 0));
return base.FetchEntity (entityToFetch);
}
I also get an error "can't convert from IEntityField2 to PageTypeFieldIndex". Somehow I have got to convert the entityToFetch.Field["CompanyId"] to an enum I think.
If you're not in the posession of the enum, don't use the enum but use a FieldCompareValuePredicate instance:
bucket.PredicateExpression.Add(new FieldCompareValuePredicate(entityToFetch.Fields["CompanyId"], null, ComparisonOperator.Equal, 0));