I have a BreezeController in a WebApi 2 project:
[BreezeController]
public class BreezeController : ApiController
{
private readonly IBreezeRepository _repo;
public BreezeController(IBreezeRepository repo)
{
_repo = repo;
}
[HttpGet]
public string Metadata()
{
return _repo.MetaData;
}
[HttpGet]
public IQueryable<Property> Properties()
{
return _repo.Properties;
}
}
My client app has this code for consuming the data:
var mgr = new breeze.EntityManager({
serviceName: "http://localhost:24830/breeze/breeze/"
});
EntityQuery
.from('Properties')
.select('ID')
.using(mgr)
.execute()
.then(querySucceeded, _queryFailed);
function querySucceeded(data) {
return data.results;
}
function _queryFailed(error) {
alert("Error while making http call: " + error.message);
}
When I run my app - it's a mobile app and it opens in Ripple - I can debug into the javascript. It runs into the _queryFailed method and I get this error message:
Metadata query failed for: http://localhost:24830/breeze/breeze/Metadata; undefined
The server is also running in the debugger. It does not hit the breakpoint in the Metadata()
method. But it does if I put the path into a browser, and it returns the MetaData.
What can I do now to investigate the problem?
EDIT
I tried something different. I opened the individual projects in separate instances of Visual Studio (I am using VS 2015 RC). I now hit the breakpoint on the server and my client goes into the querySucceeded
function. So success of a sort. So the question changes. Is there a way to set up my environment to work in just one instance of Visual Studio?
Have you tried to manually fetch the metadata?
function fetchMetadata() {
var manager = new breeze.EntityManager("api/breeze");
if (manager.metadataStore.isEmpty()) {
return manager.fetchMetadata();
}
return Q.resolve();
}
function start() {
fetchMetadata().then(function () {
// Metadata fetched.
// Do something here.
});
}
source: breeze fetch meta data if not present
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With