all groups > dotnet ado.net > april 2008 >
You're in the

dotnet ado.net

group:

ado.net entity framework newby question



ado.net entity framework newby question doph
4/23/2008 1:41:41 PM
dotnet ado.net: 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?

Re: ado.net entity framework newby question Miha Markic
4/24/2008 9:48:22 AM
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/

[quoted text, click to view]
AddThis Social Bookmark Button