Reputation: 14586
After working for months with a breeze WebAPI controller, I'm now about to start a new project with a standard WebAPI controller (I'm not that excited about it and I've got a bad feeling not being able to fully rely on breeze...)
Anyway, I'm trying to configure breeze on the client side and I'm running into an exception:
´Cannot get property « jsonResultsAdapter » of an undefined or null reference´
Here's how I've configured breezejs.
breeze service configuration
var service = new breeze.DataService({
serviceName: ('http://localhost:52446/api'),
adapterName: 'OData'
});
var manager = new breeze.EntityManager({ dataService: service });
//skip irrelevant code
function search() {
var query = breeze.EntityQuery.from("Mandate");
return manager.executeQuery(query.using(service)).then(function (result) {
}).fail(function (error) {
logger.error(error);
});
}
When I debug breezejs:
proto.using = function (obj) {
if (!obj) return this;
var eq = this._clone();
processUsing(eq, {
entityManager: null,
dataService: null,
queryOptions: null,
fetchStrategy: function (eq, val) { eq.queryOptions = (eq.queryOptions || new QueryOptions()).using(val) },
mergeStrategy: function (eq, val) { eq.queryOptions = (eq.queryOptions || new QueryOptions()).using(val) },
jsonResultsAdapter: function (eq, val) { eq.dataService = (eq.dataService || new DataService()).using({ jsonResultsAdapter: val }) }
}, obj);
return eq;
};
jsonResultAdapter is null and not set.
Why is that ?
Upvotes: 0
Views: 851
Reputation: 14586
Nevermind, I got it to work by adding the following line before the creation of the EntityManager:
breeze.config.initializeAdapterInstances({ dataService: "OData" });
Breeze Team, can you just explain why I need to do that, since I've already set adpaterName: "OData" in the DataService..... ?
Upvotes: 1