Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
*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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900