Hi,

I have downloaded and installed beta 3 of Ado.net entity framework and
played with this a little bit and it's quite cool - I can query the
database and get the objects etc. The only thing I can't dig to is how
to actually create custom attributes in the classes that the framework
has generated for me.

For example, say, I have a simple table:

UserId,
UserName,
UserAge

and I want a custom properry, say, IsOld that will be calculated at
runtime, something like

public bool IsOld{
get{
if (UserAge > 90){return true;}
else {return false;}

}
}

how do I do this?

Thanks for all your comments!

Re: ado.net entity framework newby question by Miha

Miha
Thu Apr 24 02:48:22 CDT 2008

Hi,

Generated classes are partial.
Thus you can simply create another partial class with same name living in
same namespace and add your property there.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"doph" <abolotnov@gmail.com> wrote in message
news:97891f29-9add-4c22-a0fd-7d17d4b39d65@b64g2000hsa.googlegroups.com...
> Hi,
>
> I have downloaded and installed beta 3 of Ado.net entity framework and
> played with this a little bit and it's quite cool - I can query the
> database and get the objects etc. The only thing I can't dig to is how
> to actually create custom attributes in the classes that the framework
> has generated for me.
>
> For example, say, I have a simple table:
>
> UserId,
> UserName,
> UserAge
>
> and I want a custom properry, say, IsOld that will be calculated at
> runtime, something like
>
> public bool IsOld{
> get{
> if (UserAge > 90){return true;}
> else {return false;}
>
> }
> }
>
> how do I do this?
>
> Thanks for all your comments!