Guest User

Untitled

a guest
Feb 14th, 2013
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment