Web API 2.x Project
Breeze.Server.ContextProvider.EF6
Breeze.Server.WebApi2
/// <summary>
/// Api that exposes data from breeze client
/// </summary>
[BreezeController]
[Route("breeze/[controller]")]
public class TodoesController : Controller
{
readonly EFContextProvider<MyDbContext> _contextProvider =
new EFContextProvider<MyDbContext>();
// ~/breeze/todoes/Metadata
[HttpGet]
public string Metadata()
{
return _contextProvider.Metadata();
}
// ~/breeze/todoes/Todoes
// ~/breeze/todoes/Todoes?$filter=IsArchived eq
false&$orderby=CreatedAt
[HttpGet]
public IQueryable<TodoItem> Todoes()
{
return _contextProvider.Context.TodoItems;
}
// ~/breeze/todoes/SaveChanges
[HttpPost]
public SaveResult SaveChanges(JObject saveBundle)
{
return _contextProvider.SaveChanges(saveBundle);
}
}