Add methods to a model using entity framework

前端 未结 4 758
暖寄归人
暖寄归人 2021-02-13 01:52

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.

4条回答
  •  深忆病人
    2021-02-13 01:59

    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.

提交回复
热议问题