예제 #1
0
 public Meal(Person person, DateTime dateConsumed, params Dish[] dishes) {
   // next deliberately omitted to see if entity fixup occurs on the client. 
   // Person = person;
   PersonId = person.PersonId;
   DateConsumed = dateConsumed;
   MealId = IdGenerator.GetNextId();
   Dishes = dishes.ToList();
 }
예제 #2
0
    public NonEFModelContext() {
      this._persons = new List<Person>();

      var p = new Person("John", "Smith", new DateTime(1965, 1, 1));
      p.Meals.Add(new Meal(p, new DateTime(2012, 1, 1),
                           new Dish("Spaghetti", 1),
                           new Dish("Milk", 1.5)));
      p.Meals.Add(new Meal(p, new DateTime(2012, 2, 2),
                           new Dish("Brocolli", 1),
                           new Dish("Red Wine", 1.5)));
      p.Meals.Add(new Meal(p, new DateTime(2012, 2, 2),
                           new Dish("Lamb Chop", 2),
                           new Dish("White Wine", 1.5)));
      this._persons.Add(p);

      p = new Person("William", "Jones", new DateTime(1983, 3, 15));
      p.Meals.Add(new Meal(p, new DateTime(2012, 1, 1),
                           new Dish("Brownie", 2),
                           new Dish("Milk", 1.5)));
      p.Meals.Add(new Meal(p, new DateTime(2012, 2, 2),
                           new Dish("Denver Omelette", 1),
                           new Dish("Bacon", 2),
                           new Dish("Orange Juice", 1.5)));
      this._persons.Add(p);

      p = new Person("An", "Yang", new DateTime(1977, 6, 20));
      p.Meals.Add(new Meal(p, new DateTime(2012, 2, 1),
                           new Dish("Bran Cereal", 2),
                           new Dish("Milk", 1.5)));
      p.Meals.Add(new Meal(p, new DateTime(2012, 4, 2),
                           new Dish("Denver Omelette", 1),
                           new Dish("Hash Browns", 1),
                           new Dish("Orange Juice", 1.5)));

      p.Meals.Add(new Meal(p, new DateTime(2012, 2, 2),
                           new Dish("Lamb Chop", 2),
                           new Dish("Tomato Juice", 1.5)));
      this._persons.Add(p);

    }