Trying to fetch entity with unique constraint

Posts   
 
    
wpfeffer
User
Posts: 11
Joined: 07-Oct-2008
# Posted on: 30-Apr-2010 23:20:06   

The line of code:

_daaHBM.FetchEntity(pbe, (IPrefetchPath2)pbe.ConstructFilterForUCFnameLnameEmailAddressBrokerCode());

The error:

Unable to cast object of type 'SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression' to type 'SD.LLBLGen.Pro.ORMSupportClasses.IPrefetchPath2'.

I have a unique constraint on the database table on the FName, LName, EmailAddress and BrokerCode columns. All 4 values get populated in the instance of the entity (pbe).

This is probably something really stupid that I'm overlooking.

Any help would be appreciated.

Wayne E. Pfeffer

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 01-May-2010 05:12:15   

Yes, you are casting to the wrong type (IPrefetchPath2), it should be IPredicateExpression simple_smile try this:

_daaHBM.FetchEntity(pbe, (IPredicateExpression)pbe.ConstructFilterForUCFnameLnameEmailAddressBrokerCode());
David Elizondo | LLBLGen Support Team