我有一个DTO层用于在API层、数据层和其他层之间传输数据。
我对C#中的DTO设计模式有一个问题。
示例:
我应该为 CRUD 拆分此 ProductDTO 吗?
示例:
当我传输数据时,对于ProductDTO(500字节)和ProductInsertDTO(293字节)。
示例:
public class ProductDTO{
public int Id {get;set;}
public string Name {get;set;}
public decimal Price {get;set;}
public int CategoryId {get;set;}
public string Desc {get;set;}
}
我应该为 CRUD 拆分此 ProductDTO 吗?
示例:
public class ProductInsertDTO
{
public string Name {get;set;}
public int CategoryId {get;set;}
}
当我传输数据时,对于ProductDTO(500字节)和ProductInsertDTO(293字节)。