Sam
Sam

Reputation: 14586

breezejs: trying to configure breeze with standard ODATA service

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.

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

Answers (1)

Sam
Sam

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

Related Questions