Automapping: IgnoreProperty on a component?

I am going to automate the measurement classes (which implement the IMeasurement interface) as components.

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

Apparently, I cannot use IgnoreProperty for the measurement classes themselves, that is:

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

Does anyone know how to ignore properties on a component, so I don’t get (for example) table columns created for unwanted properties of a component? (in SchemaExport)

Regards, Charles

+4
source share
1 answer

You should use OverrideAll, for example.

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

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

0
source

All Articles