Skip to content

Issue with generic Dictionary type after updating from 5.0.2 to 7.0.1 #60

@gmejias-RMS

Description

@gmejias-RMS

After updating package along with Automapper 13 to 14 I'm facing the follow exception:

Image

System.ArgumentException: type
   at LogicBuilder.Expressions.Utils.TypeExtensions.GetUnderlyingElementType(Type type)
   at AutoMapper.AspNet.OData.Expansions.DefaultExpansionsBuilder.Build(List`1 memberSelectors, ParameterExpression param, Expression parentBody)
   at AutoMapper.AspNet.OData.Expansions.DefaultExpansionsBuilder.Build(ParameterExpression param, Expression parentBody)
   at AutoMapper.AspNet.OData.Expansions.ExpansionsHelper.GetSelectedSelectors(ParameterExpression param, Expression parentBody, List`1 selects)
   at AutoMapper.AspNet.OData.Expansions.ExpansionsHelper.AddSelectors(List`1 memberSelectors, List`1 selects, ParameterExpression param, Expression parentBody)
   at AutoMapper.AspNet.OData.Expansions.ExpansionsHelper.<>c__DisplayClass2_0`1.<BuildExplicitExpansions>g__GetAllExpansions|0(List`1 memberSelectors)
   at AutoMapper.AspNet.OData.Expansions.ExpansionsHelper.BuildExplicitExpansions[TSource](IEnumerable`1 includes, List`1 selects)
   at AutoMapper.AspNet.OData.QueryableExtensions.GetQueryable[TModel,TData](IQueryable`1 query, IMapper mapper, ODataQueryOptions`1 options, QuerySettings querySettings, Expression`1 filter)
   at AutoMapper.AspNet.OData.QueryableExtensions.GetQuery[TModel,TData](IQueryable`1 query, IMapper mapper, ODataQueryOptions`1 options, QuerySettings querySettings)
   at Moodys.Entitlements.Handlers.AccountEntitlementHandler.Get(ODataQueryOptions`1 options) in

This is happening in an open type entity on a property that looks like:
[ContainerProperty] public virtual Dictionary<string, object>? DynamicProperties { get; set; }

We are using Postgres jsonb type on db (with convertion to Dictionary<string, object> at EF level).
Doing a quick experiment if I change type to List<KeyValuePair<string, object>> works, but is a breaking change for us.

I'm just tryng to get the whole entity by Id (not doing any operation over DynamicProperties, I'm aware that is not fully supported). This was working fine on version 5.0.2

Mapper profile config for entity:

CreateMap<AccountEntitlement, AccountEntitlementResponse>()
            .ForMember(dest => dest.Product, opt => opt.ExplicitExpansion())
            .ForMember(dest => dest.ProductMapping, opt => opt.ExplicitExpansion())
            .ForMember(dest => dest.Fulfillment, opt => opt.ExplicitExpansion())
            .ForMember(dest => dest.ContactEntitlements, opt => opt.ExplicitExpansion())
            .ForMember(dest => dest.QuotaDefinition, opt => opt.ExplicitExpansion());

Checking previous issues might be related to:
#55
AutoMapper/AutoMapper.Extensions.OData#229

I'd appreciate any help on this, is blocking us from upgrading package.
My apologies if this is not a real issue or if is already known.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions