Add methods to a model using entity framework

前端 未结 4 1503
梦毁少年i
梦毁少年i 2021-02-13 01:50

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 02:01

    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.

提交回复
热议问题