public void DummyData()
		{
			string[] names = {
				"accelerator", 
				"worm", 
				"Wittgenstein",
				"unprimed", 
			};
			DateTime start = DateTime.Now;
			With.Transaction(delegate
			{
				List<Subject> subjects = new List<Subject>();
				foreach (string name in names)
				{
					Subject subject = new Subject();
					subject.Name = name;
					subjects.Add(subject);
					Repository<Subject>.Save(subject);

					for (int i = 0; i < 50; i++)
					{
						Question q = new Question();
						q.Subject = subject;
						subject.Questions.Add(q);
						q.Title = "Question #" + i;
						q.Content = "Why?";
						q.Answer = "Because!";
						Repository<Question>.Save(q);
					}
				}
				PropertyBag["subjects"] = subjects;
			});
			PropertyBag["duration"] = DateTime.Now - start;
		}
Example #2
0
		public virtual void Insert(bool shouldThrow)
		{
			Subject s = new Subject();
			s.Name = "abc";
			Repository<Subject>.Save(s);
			if (shouldThrow)
				throw new Exception("bummer");
		}