WHERE does the gantt data come from here?

In this nice example, dhtmlx.com/blog/using-dhtmlx … p-net-mvc/

with the solution at the end there?

when the solution gets run/F5 and launches, draws an empty Gantt, it takes about 10 seconds (very fast pc) and then the gantt data fills in. today, yesterday and yest - 2

where… WHERE does it get this?

I blocked/commented out the DAL

[code]
namespace Gantt.DAL
{
public class GanttInitializer : DropCreateDatabaseIfModelChanges
{
//protected override void Seed(GanttContext context)
//{
// List tasks = new List()
// {
// new Task() { Id = 1, Text = “Project #888i8902”, StartDate = DateTime.Today.AddDays(-3), Duration = 18, SortOrder = 10, Progress = 0.4m, ParentId = null },
// new Task() { Id = 2, Text = “Task #1”, StartDate = DateTime.Today.AddDays(-2), Duration = 8, SortOrder = 10, Progress = 0.6m, ParentId = 1 },
// new Task() { Id = 3, Text = “Task #2”, StartDate = DateTime.Today.AddDays(-1), Duration = 8, SortOrder = 20, Progress = 0.6m, ParentId = 1 }
// };

    //    tasks.ForEach(s => context.Tasks.Add(s));
    //    context.SaveChanges();

    //    List<Link> links = new List<Link>()
    //    {
    //        new Link() { Id = 1, SourceTaskId = 1, TargetTaskId = 2, Type = "1" },
    //        new Link() { Id = 2, SourceTaskId = 2, TargetTaskId = 3, Type = "0" }
    //    };

    //    links.ForEach(s => context.Links.Add(s));
    //    context.SaveChanges();
    //}
}

}[/code]

which matches what comes up. I have gone into each file, each method, each ? and searched many hours on the solution.

in the HomeController.cs

[HttpGet] public JsonResult Data3() { var jsonData = new { // create tasks array data = ( from t in db.Tasks.AsEnumerable() select new { id = t.Id, text = t.Text, start_date = t.StartDate.ToString("u"), duration = t.Duration, order = t.SortOrder,

I try to single step? the debugger stops at var jsonData = new, that entire block is a step. After it steps? there are 3 arrays with the 3 tasks. how? where? from what?

The goal is to pass in one database record’s reference to this so that it generates the json data and draws the Gantt; i was trying to understand how it works first, but its as if this empty invisible null instance of db.Tasks.AsEnumerable() somehow pulls in, from the air, 3 tasks references

Hi,
gantt.load(url) expect backend to respond with the JSON of following structure:
docs.dhtmlx.com/gantt/desktop__s … rmats.html
So what JsonResult data does is maps contents of tables that store tasks and their relations to that format and pops it to the client.
This demo uses EntityFramework Code First approach, which means that data entities are defined in code, and when they are first accessed EF creates a database for them using given connection string. The Seed method is called right after database is created and is used to populate it with some test data
entityframeworktutorial.net/ … first.aspx

So the big delay is caused by database initialization. It should happen in two cases:

  • when you firstly run the app and database does not exists yet
  • when you do some changes in model classes and db is getting updated accordingly

If it’s initialized more often (which would be strange though), try changing changing initializer strategy from this

public class GanttInitializer : DropCreateDatabaseIfModelChanges<GanttContext>

to this public class GanttInitializer : CreateDatabaseIfNotExists<GanttContext>