Add calculated Property To Entity

Posts   
 
    
abdo
User
Posts: 10
Joined: 23-Feb-2009
# Posted on: 09-Sep-2010 20:53:11   

Dear LLBL Team,

Now I need to add calculated Age Property to my entity,

but i don't need to use TypedList or TypedView.

I found i can do it using ExtendedEntityFactory.

but i have a problem regarding how can i till the llbl to use my expression to calculate age.

Waiting to hear from you.

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Sep-2010 04:24:28   

Hi abdo,

Do you want to calculate it in-memory or server-side. For example, if the entity has the a DateOfBirth field, you can just add a custom property to the entity:

public int Age
{
     get 
     {
          TimeSpan timeOfLife = DateTime.Now.Subtract(DateOfBirth);
           return timeOfLife.Years();
     }
}

You can add that in the entity USER_CODE_REGION or in a partial class. If you want to execute a server side expression, please tell us what are the involved fields and what you really want.

David Elizondo | LLBLGen Support Team