eka808 eka808 - 1 year ago 128
C# Question

Add methods to a model using entity framework

With entity framework, is it possible to add methods to an object class ?
For example, i have a CLIENT mapping and i would like to create a "getAgeFromBirhDate" method.

Answer Source

Yes. It's possible. Entity Framework generates Partial Classes.

That means you can create another file that contains another portion of the Partial Class definition (with your additional methods) and everything will work just fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download