using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ModelFirst
{
class Program
{
static void Main(string[] args)
{
Model1Container context = new Model1Container();
//Customer customer = new Customer() { CustomerName = "zhangsan", CustomerPwd = "123" };
//Order order1 = new Order() { ProductName = "apple", Customer = customer };
//Order order2 = new Order() { ProductName = "banana", Customer = customer };
//context.Customer.Add(customer);
//context.Order.Add(order1);
//context.Order.Add(order2);
//context.SaveChanges();
var customers = from c in context.Customer
select c;
foreach (var c in customers)
{
Console.WriteLine(c.CustomerName + ":");
foreach (var o in c.Order)
{
Console.WriteLine(o.ProductName);
}
}
Console.Read();
}
}
}