*I am developing a demo application using HotTowel SPA in VS2012. Using breeze I am trying to expose the model and use it for querying the database.I used reference for this application using this link
Creating Single Page Application using Hot Towel Template.
Here is some of my code
// My Class
public class JobDemoClass
{
public int Id { get; set; }
public string JobName { get; set; }
public string JobDescription { get; set; }
public DateTime StartTime { get; set; }
}
// My DbContext
public class JobDemoDbContext : DbContext
{
public DbSet<jobdemoclass> JobDemo { get; set; }
public JobDemoDbContext()
: base("SPAConnection")
{
Database.SetInitializer<jobdemodbcontext>(null);
}
}
//My Controller
[BreezeController]
public class ScottController : ApiController
{
readonly EFContextProvider<jobdemodbcontext> _contextProvider = new EFContextProvider<jobdemodbcontext>();
[System.Web.Http.HttpGet]
public string Metadata()
{
return _contextProvider.Metadata();
}
[System.Web.Http.HttpPost]
public SaveResult SaveChanges(JObject saveBundle)
{
return _contextProvider.SaveChanges(saveBundle);
}
[System.Web.Http.HttpGet]
public IQueryable database()
{
return _contextProvider.Context.JobDemo;
}
//Some Route in Shell.js
var routes = [
{ route: '', moduleId: 'jobs', title: 'Scheduled Jobs', nav: 1 },
{ route: 'jobadd', moduleId: 'jobadd', title: 'Add a job', nav: 2 },
{route:'JobEdit/:id',moduleId: 'jobedit', name : 'Edit Job', visible: false}];
But here I m facing a problem , while using
manager.ExecuteQueryLocally.from("database");
// database is a method defined in the controller
//Error
Uncaught Error: There is no metadata available for this query
This error is coming when I am trying to navigate the to "jobadd" and "jobedit" view.
I tried changing some of my code but still its showing the same error