Print Page | Close Window

Predicate + Navigation

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2466
Printed Date: 01-Apr-2025 at 7:15pm


Topic: Predicate + Navigation
Posted By: Molinari
Subject: Predicate + Navigation
Date Posted: 26-Jan-2011 at 5:29am
Hi,

I have one problem in execute this query with predicate

_em.Person.Where(f=>f.Person_Profile.Id_Person_Profile == 1); to works perfectly....

but i trying using with predicate....

public void Get(Person QueryOperation)
{

List<PredicateDescription> predicateDescriptions = new List<PredicateDescription>();

PredicateDescription aPredicateDescription;

if (QueryOperation.Person.Person_Profile != null)
{
aPredicateDescription = PredicateBuilder.Make(typeof(Person), "Person_Profile", FilterOperator.IsEqualTo, QueryOperation.Person_Profile);
              
predicateDescriptions.Add(aPredicateDescription);
}

//TODO: execute the query ...
}

then show this error

Unable to create a constant value of type 'Crmall.Entities.Person_Profile'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.

then i change code    

aPredicateDescription = PredicateBuilder.Make(typeof(Person), "Person_Profile.Id_Person_Profile", FilterOperator.IsEqualTo, QueryOperation.Person_Profile.Id_Person_Profile);

then show this error..

Unable to locate property 'Person_Profile.Id_Person_Profile' on type 'Crmall.Entities.Person'.......

Ok... then change code

aPredicateDescription = PredicateBuilder.Make(typeof(Person_Profile), "Person_Profile.Id_Person_Profile", FilterOperator.IsEqualTo, QueryOperation.Person_Profile.Id_Person_Profile);

then show same error

Unable to locate property 'Person_Profile.Id_Person_Profile' on type 'Crmall.Entities.Person_Profile'.......


then ideabladeTeam is that possible ?

thanks...







Replies:
Posted By: sbelini
Date Posted: 26-Jan-2011 at 9:51am
Hi Molinari,
 
It will be possible in DevForce6.0.8 coming up this week:
 
aPredicateDescription = PredicateBuilder.Make(typeof(Person), "Person_Profile.Id_Person_Profile", FilterOperator.IsEqualTo, QueryOperation.Person_Profile.Id_Person_Profile);

Regards,
   Silvio.


Posted By: Molinari
Date Posted: 26-Jan-2011 at 10:04am
Ok.. thanks


Posted By: Molinari
Date Posted: 07-Feb-2011 at 9:29am
Hi Sivio,

Now I have more one problem... =/   two tables (Person) (Person_Email) example : one person has Zero Or More Person_Email

public void Get(Person QueryOperation)
{
aPredicateDescription = PredicateBuilder.Make(typeof(Person), "Person_Email.Email", FilterOperator.Contains, QueryOperation.Person_Email.First().Email);

}

show error (Unable to locate property 'EMAIL' on type 'IdeaBlade.EntityModel.RelatedEntityList`1[Project.Entities.Person_Email]'.)

how solve ?

thanks



Print Page | Close Window