I have the following code in a model
base.Name = instance.Name;
base.SSN = instance.SSN;
base.DateModified = DateTime.Now
base.ClienType = instance.ClientType;
If I add more properties to my base then i have to update my model to update the properties. Is there an easier way to update the base.properties instead of listing each of them and then updating the same? Yes i know i am being lazy
我不太确定为什么要这样做,但是您可能想看看AutoMapper-如果双方的属性都相同,则可以自动将一个映射到另一个而无需进行任何实际设置。
You could use Automapper to automatically map where there is a naming convention.
Also beware that things the following would not map as one has one less t
base.ClienType = instance.ClientType;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.