Mapping business Objects and Entity Object with reflection c#
问题 I want to somehow map entity object to business object using reflection in c# - public class Category { public int CategoryID { get; set; } public string CategoryName { get; set; } } My Entity Class has same properties, CategoryId and CategoryName.Any best practice using reflection or dynamic would be appreciated. 回答1: You can use Automapper or Valueinjecter Edit: Ok I wrote a function that uses reflection, beware it is not gonna handle cases where mapped properties aren't exactly equal e.g