Add methods to a model using entity framework

前端 未结 4 1505
梦毁少年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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 02:22

    public static class ModelExtended
    {
        public static void SaveModelToXML(this Model1Container model, string xmlfilePath)
        {
            ///some code
        }
    }
    

提交回复
热议问题