Skip to content

ConnectionSettings DefaultMappingFor doesn’t support base class mapping anymore #3929

@sladeos

Description

@sladeos

NEST/Elasticsearch.Net version:
7.0.0/7.0.0
Elasticsearch version:
7.2.0

Description of the problem including expected versus actual behavior:
After upgrading to NEST 7 I noticed that properties which were ignored in 6.4.2 were no longer ignored. I'm not sure that the it was supposed to work in the first place though.
I've looking though the breaking changes for 7.0 but didn't see anything about this.

If you have a class Status:

public class Status
{
   public string Name { get; set; }
   public string Description { get; set; }
   public string Severity { get; set; }
}

and various sub classes for different objects:

public class OrderStatus : Status
{
}

public class EnquiryStatus : Status
{
}

in 6.4.2 (possibly higher version not tested) one could ignore all status implementations by just configuring the mapping for the base class:

var settings = new ConnectionSettings(pool, connection)
                    .DefaultMappingFor<StatusType>(s => s
                        .Ignore(i => i.Description)
                        .Ignore(i => i.Severity));

but now it seems one must define a mapping for each implementation.
Is there a way to make it work like it did before or must each implementation be defined?

Metadata

Metadata

Assignees

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