Can't run this sample

Feb 24, 2014 at 10:47 AM
what are the following databases and where do I get them to run the LTI sample?

4 - Add an SQL Server Database called lti-consumer.mdf to the Consumer/App_Data directory.
5 - Add an SQL Server Database called lti-provider.mdf to the Provider/App_Data directory.

Is it required that sql server is installed on the system to build and run the LTI sample?
Coordinator
Mar 6, 2014 at 5:10 AM
Yes.
Mar 7, 2014 at 8:22 AM
From where do I get the database files lti-consumer.mdf and lti-provider.mdf?

Also after getting these files I'll need to mount it on SQL Server - right?
Coordinator
Mar 8, 2014 at 5:44 PM
They can both be empty. Both projects are setup to use Entity Framework Code First and migrations. Here is what I do in Visual Studio:
  1. Right click on the App_Data folder and select Add > SQL Server Database.
  2. Replace the suggested database name with "lti-consumer" or "lti-provider". These are the database names in the DefaultConnection string in web.config.
  3. In the Package Manager Console enter the command "update-database". This will apply the migrations in the Migrations folder.
You can, of course, change the DefaultConnection string in web.config and have the app use any database you want. As long as it is compatible with EntityFramework, you should be able to apply the migrations to add all the right tables.
Mar 10, 2014 at 1:14 PM
I run into this error when I enter the command "update-database" on the Package Manager Console:

Running Seed method.
System.Data.SqlClient.SqlException (0x80131904): There is insufficient system memory in resource pool 'internal' to run this query.

The task manager shows that SQL Server is using a lot of memory...
Coordinator
Mar 11, 2014 at 1:47 PM
You can comment out (or remove) these lines from Migrations > Configuration.cs > Seed. This code loads some lookup files which are not required to run the samples (they are used to set the users location...which is not required for LTI, although it is useful in K-12 world). If this does not resolve the issue, try emptying the Seed method completely.
            if (context.Database.SqlQuery<int>("select count(0) from States").FirstOrDefault() == 0)
            {
                using (var archive = ZipFile.OpenRead(Path.Combine(appData, "States.zip")))
                {
                    var entry = archive.GetEntry("States.sql");
                    using (var reader = new StreamReader(entry.Open()))
                    {
                        context.Database.ExecuteSqlCommand(reader.ReadToEnd(), new object[] { });
                    }
                }
            }
            if (context.Database.SqlQuery<int>("select count(0) from Districts").FirstOrDefault() == 0)
            {
                using (var archive = ZipFile.OpenRead(Path.Combine(appData, "Districts.zip")))
                {
                    var entry = archive.GetEntry("Districts.sql");
                    using (var reader = new StreamReader(entry.Open()))
                    {
                        context.Database.ExecuteSqlCommand(reader.ReadToEnd(), new object[] { });
                    }
                }
            }
            if (context.Database.SqlQuery<int>("select count(0) from Schools").FirstOrDefault() == 0)
            {
                using (var archive = ZipFile.OpenRead(Path.Combine(appData, "Schools.zip")))
                {
                    var entry = archive.GetEntry("Schools.sql");
                    using (var reader = new StreamReader(entry.Open()))
                    {
                        context.Database.ExecuteSqlCommand(reader.ReadToEnd(), new object[] { });
                    }
                }
            }