-
Notifications
You must be signed in to change notification settings - Fork 54
Description
I left a post on StackOverflow for several days with no responses, and I am sure this has to be something I am doing wrong, but everything being roughly coded to what I think should work simply isn't working.
I have a "DomainContext" class that I am attempting to have exist between my EF Core DbContext and my API. It was very basic mapping proeprties like this:
public class PropertyDomainContext
{
private readonly PropertyDbContext _dbContext;
private readonly IMapper _mapper;
public PropertyDomainContext(PropertyDbContext dbContext, IMapper mapper)
{
_dbContext = dbContext;
_mapper = mapper;
}
public IQueryable<AppraisalYear> AppraisalYear => _dbContext.AppraisalYear.UseAsDataSource(_mapper).For<AppraisalYear>();
. . .
}Any time I attempt to expand a navigation property through the Url such as https://localhost:44308/odata/AppraisalYear(2019)?$expand=PropertyYearLayer, I get an error "Argument types do not match". I tried debugging the problem on my own and I think the problem is that the approach I am using is transforming the parent type, but failing to transform the type for the child navigation property.
I believe this isn't a problem with my mapping profile because I can hit the endpoint for both https://localhost:44308/odata/AppraisalYear and https://localhost:44308/odata/PropertyYearLayer just fine and I can perform other OData operations as well ($skip, $top, $select, $orderby, etc.) The error only occurs when I attempt to use $expand.
I am sure its simply that I am missing a step, not doing something right, using the wrong function, or something else. I don't know where else to turn however.