public DummyEntities() { choirAID = Guid.NewGuid(); choirBID = Guid.NewGuid(); studentA = new Student() { FirstName = "StudentA", Id = Guid.NewGuid(), ChoirId = choirAID }; studentB = new Student() { FirstName = "StudentB", Id = Guid.NewGuid() }; choirA = new Choir() { Id = choirAID, Name = "ChoirA", Students = (from s in Students where s.ChoirId == choirAID select s).ToList() }; choirB = new Choir() { Id = choirBID, Name = "ChoirB", Students = (from s in Students where s.ChoirId == choirBID select s).ToList() }; studentA.Choir = choirA; rollA = new Roll() { Id = Guid.NewGuid() }; rollB = new Roll() { Id = Guid.NewGuid(), ChoirId = choirA.Id }; }
public static void InitDemoData() { var context = Container.Current.Resolve<IBusinessManagerEntities>(); var control = (from c in context.Controls select c).FirstOrDefault(); var students = new string[]{"Ben Woodcock", "Nat Woodcock", "Fred Durst", "Jimmy Dorantee", "Daniel Payne", "David Leader", "John Deeves"}.ToList(); if (control == null) { var c = new Choir(); c.Id = Guid.NewGuid(); c.Name = "ChoirA"; context.AddChoir(c); students.ForEach(n => { var s = new Student(); s.Id = Guid.NewGuid(); var names = n.Split(' '); s.FirstName = names[0]; s.LastName = names[1]; s.ChoirId = c.Id; context.AddStudent(s); }); c = new Choir(); c.Id = Guid.NewGuid(); c.Name = "ChoirB"; context.AddChoir(c); c = new Choir(); c.Id = Guid.NewGuid(); c.Name = "ChoirC"; context.AddChoir(c); control = new Control(); control.Id = Guid.NewGuid(); context.AddControl(control); context.Save(); } }
public virtual void AddChoir(Choir choir) { ((List<Choir>)Choirs).Add(choir); }
public void AddChoir(Choir choir) { Choirs.Add(choir); }