4

I am automapping measurement classes (that implement interface IMeasurement) as components.

This works fine, but I have some attributes in the components I would like to ignore.

Apparently I cannot use IgnoreProperty on the measurement classes themselves, i.e.:

[ .ForTypesThatDeriveFrom(p => p.IgnoreProperty(x => x._uomSpecified)) ] where MeasuredDepthCoord is a component of Wellbore (actually several times with different property names, MdCurrent, TvdCurrent, MdKickoff, MdPlanned, etc.

Anyone know how to ignore properties on a component, so I do not get (for example) table columns generated for unwanted component properties? (in SchemaExport)

Regards, Charles

Yggdrasil
  • 51
  • 3

1 Answers1

0

You must use OverrideAll, e.g.

        .OverrideAll(map =>
            {
                map.IgnoreProperties(x =>
                    {
                        if (x.Name.Equals("_uomSpecified")
                            return true;
                        return false;
                    }
                );
            })

And you can also check other properties of x, to check against type, attributes, etc. if you need.

Jouni Aro
  • 2,099
  • 14
  • 30