In the previous post we have seen how simple we can map database table to class. Let's extend the mapping.
Suppose we don't want to use CustomerID. Instead, we want ID property. Also we want to add ModifiedDate column. Here is the code
public class Store2
{
[EntityProperty("CustomerID")]
public int ID { get; set; }
public string Name { get; set; }
public DateTime ModifiedDate { get; set; }
}
The program might look like previous version with Store class.
static void Main(string[] args)
{
var query = new QueryCmd(exam1sharp.Properties.Settings.Default.connString);
foreach (Store2 s in query
.From(new SourceFragment("Sales", "Store"))
.ToPODList())
{
Console.WriteLine("Store id: {0}, name: {1}", s.ID, s.Name);
}
}