CodeSmith Community
Your Code. Your Way. Faster!

Newbie - How do I DeepLoad?

Latest post 05-10-2008 4:30 PM by fweeee. 6 replies.
  • 05-09-2008 5:40 PM

    Newbie - How do I DeepLoad?

    I've combed these forums for instructions on how to DeepLoad, and I think I'm either missing something or else my situation is somewhat unique (perhaps my DB architecture is off?). Here's what I'm trying to do:

    I have a table called Task:

    PK   TaskID
            Name
            Desc

    I have another table called Task_Date:

    PK   TaskDateID
    FK   TaskID
            Date
            Hours

    Now, I've instantiated a Task object using the following:

    Task tsk = AgencyQueue.Data.DataRepository.TaskProvider.GetByTaskID(2);

    Now my question is, how do I use DeepLoad to get a collection of associated TaskDate records? None of the documentation I've read really works - there are some things I think I should be getting with intellisense (according to the examples) that I'm not getting and I'm not sure why?

    I tried this and no dice:

    DataRepository.TaskProvider.DeepLoad(tsk, true, DeepLoadType.IncludeChildren, typeof(TList<TaskDate>)); 

    • Post Points: 35
  • 05-09-2008 7:18 PM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 192
    • Points 4,783

    Re: Newbie - How do I DeepLoad?

    I think something like this should work:

    taskService.DeepLoad(task, false, DeepLoadType.IncludeChildren, typeof(Tlist<Task_Date>);

     You should see your taskdate records in task.Task_DateCollection

    • Post Points: 35
  • 05-09-2008 11:07 PM In reply to

    Re: Newbie - How do I DeepLoad?

    There is no TaskService in my DAL? 

    • Post Points: 5
  • 05-10-2008 12:27 AM In reply to

    Re: Newbie - How do I DeepLoad?

    ok, i've got TaskService now, but i'm still totally confused. i have this:

    TaskService tskSvc = new TaskService();
    Task tsk = tskSvc.DeepLoadByTaskId(2, true, DeepLoadType.IncludeChildren, typeof(TList<TaskDate>));

    so how do i access the list of TaskDate records?

    • Post Points: 35
  • 05-10-2008 3:15 AM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 192
    • Points 4,783

    Re: Newbie - How do I DeepLoad?

    The TaskDate records should be hanging off the Task record (tsk).

     As they are children records, it should be something like tsk.TaskDateCollection

    • Post Points: 35
  • 05-10-2008 9:52 AM In reply to

    Re: Newbie - How do I DeepLoad?

    I'm not getting TaskDateCollection in intellisense. Can you tell me what I'm doing wrong and what I need to do to fix this? 

    • Post Points: 35
  • 05-10-2008 4:30 PM In reply to

    • fweeee
    • Top 25 Contributor
    • Joined on 08-08-2007
    • Posts 192
    • Points 4,783

    Re: Newbie - How do I DeepLoad?

     Well that is odd. Assuming that you have a relationship (in SQL) between Task.TaskID and Task_Date.TaskID, and generated the code after the relationship was made, you should have a TaskDateCollection on your Task entity.

    • Post Points: 5
Page 1 of 1 (7 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems