Mapping Validation Attributes From Domain Entity to DTO

前端 未结 8 2206
轮回少年
轮回少年 2020-12-13 02:21

I have a standard Domain Layer entity:

public class Product
{
    public int Id { get; set; }

    public string Name { get; set; }

    public decimal Price         


        
8条回答
  •  离开以前
    2020-12-13 03:02

    It turns out that AutoMapper may be able to do this for us automagically, which is the best case scenario.

    AutoMapper-users: Transfer validation attributes to the viewmodel?
    http://groups.google.com/group/automapper-users/browse_thread/thread/efa1d551e498311c/db4e7f6c93a77302?lnk=gst&q=validation#db4e7f6c93a77302

    I haven't got around to trying out the proposed solutions there, but intend to shortly.

提交回复
热议问题