For example, if I wanted my class property to be named like this for a laugh:
class Product
{
[Key]
int ProductID {get;set;}
[Required]
string TitleTOTHEMAX {get;set;}
}
My Sql table has 2 columns "ProductID" and "Title", how do I tell the class's property to map itself to "Title" column considering the "TitleTOTHEMAX" column does not exist :)
There are a number of ways to achieve this but one is to specify a Column attribute on the property.
[Column("Title")]
See here for more information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With