ndsc
ndsc

Reputation: 1213

Breeze and the Entity Data Model with Navigation Property throws error

Using Breeze and a simple one to many relationship created using the Entity Data Model designer gives me the following error:

TypeError {stack: "TypeError: Cannot read property '$type' of null↵ …//localhost:55494/Scripts/jquery-1.9.1.js:1083:7)", query: null}

I figured out that Breeze throws that error when using a Navigational Property and that property is Null. What am I missing here?

I got the following relationship:

Designer

Controller code:

private readonly EFContextProvider<ModelContainer> _contextProvider = new EFContextProvider<ModelContainer>();

[HttpGet]
public string Metadata()
{
    return _contextProvider.Metadata();
}

[HttpGet]
public IQueryable<Appointment> Appointments()
{
    return _contextProvider.Context.Appointments;
}

Using the following query:

var query = breeze.EntityQuery.from('Appointments');

This is the raw JSON output:

[{"Id":1,"Date":"2013-01-01T00:00:00","Comments":"Testing","Car":null}]

Upvotes: 2

Views: 206

Answers (1)

Jay Traband
Jay Traband

Reputation: 17052

Do you have a [BreezeController] attribute on your ApiController?

Upvotes: 3

Related Questions