ValueInjecter injecting from a method

106 Views Asked by At

Is it posible to inject a value from a method using ValueInjecter ?

Similar to what AutoMapper do (GetTotal()) : https://github.com/AutoMapper/AutoMapper/wiki/Flattening

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

it can be done, but you would have to create your own injection that will be able to do that: for example you could grab the code for SmartConvetionInjection

http://valueinjecter.codeplex.com/wikipage?title=SmartConventionInjection

and add the feature of matching property names to methods that Start with Get+ThatName

atm only the properties are scanned, note the line

    var sourceProps = source.GetProps();
    var targetProps = target.GetProps();