A general approach is to map objects to your domain classes, which you name using standard C # conventions.
So, in this table product_id, product_name, categori_id, .. you point to:
public class Product { public int Id { get; set; } public string Name { get; set; } public int Category { get; set; } }
Then you create the mapper helper, which translates the object into a domain object:
public Product ProductMapper(EntityProduct entity) { return new Product { Id = entity.product_id, Name = entity.product_name, Category = entity.category_id, } }
I leave the decision for you whether mapper should be a separate helper class, a static method in the Product class. In addition, when saving data, you change the process, that is, you map the domain object to the entity.
source share