Database Reference
In-Depth Information
order = new WebOrder { CustomerName = "Steve Jones",
OrderDate = DateTime.Parse("1/1/2008"),
IsDeleted = true, Amount = 600 };
context.WebOrders.Add(order);
context.SaveChanges();
}
using (var context = new EF6RecipesContext())
{
Console.WriteLine("Orders");
Console.WriteLine("======");
foreach (var order in context.WebOrders)
{
Console.WriteLine("\nCustomer: {0}", order.CustomerName);
Console.WriteLine("OrderDate: {0}", order.OrderDate.ToShortDateString());
Console.WriteLine("Is Deleted: {0}", order.IsDeleted.ToString());
Console.WriteLine("Amount: {0}", order.Amount.ToString("C"));
}
}
The output of the code in Listing 6-30 follows. Notice that only customers that meet the criteria that we defined in
the Entity SQL expression inside the QueryView are displayed.
Orders...
Customer: John Stevens
Order Date: 1/1/2011
Is Deleted: False
Amount: $400.00
Customer: Jim Allen
Order Date: 5/3/2012
Is Deleted: False
Amount: $200.00
Customer: Mike Hammer
Order Date: 6/3/2013
Is Deleted: True
Amount: $1,800.00
6-11. Using Complex Conditions with Table per Hierarchy
Inheritance
Problem
You want to model a table using Table per Hierarchy inheritance by applying conditions more complex than those
supported directly by Entity Framework.
 
Search WWH ::




Custom Search