Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 14th, 2013  |  syntax: None  |  size: 0.73 KB  |  views: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public class Goal
  2. {
  3.     public string Text { get; set; }
  4.     public List<SubGoal> SubGoals { get; set; }
  5. }
  6.  
  7. public class SubGoal
  8. {
  9.     public string Text { get; set; }
  10.     public List<Practise> Practices { get; set; }
  11.     public List<Measure> Measures { get; set; }
  12. }
  13.        
  14. public interface IGoalPlannerRepository
  15. {
  16.     IEnumerable<Goal> FindAll();
  17.     Goal Get(int id);
  18.     void Save(Goal goal);
  19. }
  20.        
  21. CREATE PROCEDURE get_GoalAndAllChildObjects
  22.     @goal_id int
  23. AS
  24. SELECT * FROM goal WHERE goal_id = @goal_id
  25. SELECT * FROM subgoals WHERE goal_id = @goal_id
  26.        
  27. using (var multi = connection.QueryMultiple("get_GoalAndAllChildObjects", new {goal_id=m_goal_id})) {
  28.     var goal = multi.Read<Goal>();
  29.     var subgoals = multi.Read<SubGoal>();
  30. }