Using LLBLGen 2.0.0.0 Final demo, Self servicing, .net 1.1, vs2003
Forgive me if I’m going about this the wrong way but I am new to LLBLGEN.
I’m having trouble filtering using the predicate and relationship functionality. Please could someone give me some pointers.
My test database contains the following tables and relationships:
PROVIDER (fields: ID)
PROVIDERINFO (fields: ID(pk), ProviderId, Name)
PRODUCT (fields: ID, ProviderId)
PRODUCTINFO (fields: ID(pk), ProductId, Name)
PROVIDER has a 1:n relationship with both PROVIDERINFO and PRODUCT (fk= ProviderId in each case)
PRODUCT has a 1:n relationship with PRODUCTINFO (fk=ProductId)
I need to create a filter that returns a PRODUCT Collection for all PRODUCT entries where PRODUCTINFO.Name=”UncleT” and PROVIDERINFO.NAME=”me”
So, my code needs to be something like...
ProductCollection products=new ProductCollection();
PredicateExpression predicate=new PredicateExpression();
RelationshipCollection relations=new RelationshipsCollection();
relations.Add(ProductEntity.Relations.ProductInfoUsingProductId,"Alias_ProductInfo");
predicate.Add(ProductInfo.Name.SetObjectAlias("Alias_ProductInfoA ") ==”UncleT”);
relations.Add(ProductEntity.Relations.ProviderUsingProviderId & ProviderEntity.Relations.ProviderInfoUsingProviderId,”Alias_ProviderInfo”);
predicate.AddWithAnd(ProviderInfo.Name. SetObjectAlias("Alias_ProviderInfo") == “me”);
products.GetMulti(predicate,0,null,relations);
...but you can't add multiple relationships under a single alias as I have done above, so how should I create a predicate expression where each predicate uses different sets of relationships?