LLBLGen Pro 1.0.2005.1 Final
Generator Configuration : Adapter
Hi EveryOne,
I have three tables:
User - UserId Name Company
Link - UserId AddressId
Address - AddressId Address1 Address2 State Country
Relations:
User.UserId - PrimaryKey
Link.UserId - ForeignKey
Link.AddressId - PrimaryKey
Address.AddressID - ForeignKey
I need to get the details in User table based on the State.
There is no direct relation between User and Address table. So i tried to add a new relation in the LLBLGen UI as User - Link - Address,
and in my application wrote this code:
public static HelperClasses.EntityCollection GetData(string state)
{
EntityCollection results = new EntityCollection(new UserEntityFactory());
IPrefetchPath2 path = new PrefetchPath2((int)EntityType.UserEntity);
path.Add(UserEntity.PrefetchPathLink);
path.Add(UserEntity.PrefetchPathAddressCollectionViaLink);
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.PredicateExpression.Add(PredicateFactory.CompareValue
(AddressFieldIndex.State, ComparisonOperator.Equal, state));
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(results, bucket, path);
return results;
}
But I get this error with the FetchEntityCollection line:
"An exception was caught during the execution of a retrieval query: The column prefix 'Testdb.dbo.Address' does not match with a table name or alias name used in the query.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."
How to Solve this issue?
Plz help.
Thanks in Advance,
Dhivya.