AutoMapper / AutoMapper.Extensions.OData

Creates LINQ expressions from ODataQueryOptions and executes the query.
MIT License
140 stars 38 forks source link

Support for Custom Value resolvers. #116

Closed YRCristiPagu closed 2 years ago

YRCristiPagu commented 2 years ago

Hi,

I have a custom value resolver used in my map and when I try to make a call with GetQueryAsync I get a timeout. If I replace the custom value resolver on the property with an Ignore() then the query works. Is the custom value resolver not supported?

BlaiseD commented 2 years ago

You're probably correct. The relevant code is here.

Expression mapping does not use custom resolvers. Not sure if ProjectTo does either. You should be able to confirm by testing your configuration against MapExpression and ProjectTo.

YRCristiPagu commented 2 years ago

Hi Blaise, Thank you for your response! I can confirm this is not supported. I found also in the AutoMapper documentation that the value resolvers are not supported for IQueryable extensions (see here). Do you have any ideas of workarounds? For now the current setup is that we have a DbSet from a view. There is a one to many relationship with another view, but that is not possible to set up in entity, because you cannot have a foreign key to a view. We have a Member Value Resolver that maps the elements from that makes a separate request to get the related entity and map it to the property. We need to support filtering on that property.

BlaiseD commented 2 years ago

Best to create a sample repository demonstrating the problem. That will make it easier to determine either way.