please
return (DateTime.Today - BirthDate).Years;

On Thu, Jun 24, 2010 at 11:27 AM, Eddie <[email protected]> wrote:

> Hi, I have some properties object that are not mapped in a hbm file.
> The field doesn't exists in the DB.
>
> As an example I have the fiel Age, just to show what I need to
> achieve.
>
>
>    public class PersonaHp
>    {
>        private DateTime _birthDate;
>        private int _age;
>
>        public virtual DateTime BirthDate
>        {
>            get { return _birthDate; }
>            set { _birthDate = value; }
>        }
>
>        public virtual int Age
>        {
>            get
>            {
>                _age = -1;
>                TimeSpan ts =  DateTime.Now - FechaNacimiento;
>                _age = ts.Days/365;
>
>                return _age;
>            }
>        }
>
>    }
>
>
> I get no error but Age is always equals to 0.
> There is a way to work with this kind of properties?
>
> Thanks to all.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to