Igor Quirino
Igor Quirino

Reputation: 1195

WebApi OData v3 Expand with EF 6 Lazy Load Disabled

I have disabled lazy load from my DbContext

base.Configuration.LazyLoadingEnabled = false;

When I use OData v3 $expand parameter, Company object isn't get filled.

http://localhost:36983/odata/Projects?$top=10&$skip=0&$expand=Company&$inlinecount=allpages

If I Enable lazy load, it get filled.

But I dont want to set Include on ProjectController like:

[EnableQuery]
public PageResult<Project> GetProjects()
{
    return new PageResult<Project>(db.Project.Include("Company"));
}

This could be a Bug Issue of WebApi OData v3?

Upvotes: 1

Views: 581

Answers (1)

Igor Quirino
Igor Quirino

Reputation: 1195

No, this isn't a bug.

I really have to Include nested objects.

Thank you.

Upvotes: 1

Related Questions