TinyIoC icon indicating copy to clipboard operation
TinyIoC copied to clipboard

Select greediest non-obsolete constructor

Open adbre opened this issue 11 years ago • 1 comments

I want TinyIoC to automatically select constructor, but I do not want TinyIoC to select a constructor marked with the ObsoleteAttribute.

Since this may break compability with current resolution behaviour, what about

Container.Register<MyClass>().IgnoreObsoleteConstructors();

or

Container.IgnoreObsoleteConstructors = true;

adbre avatar Apr 17 '14 12:04 adbre

My suggestion is writing a customization class that TinyIoC can use to perform this type of work and others. See Autofixture for ideas or

http://blog.ploeh.dk/2009/09/22/CustomizingAType'sBuilderWithAutoFixture/ http://blog.ploeh.dk/2010/10/19/Convention-basedCustomizationswithAutoFixture/

or

https://github.com/ghostsquad/SharpZendeskApi/blob/master/SharpZendeskApi/ContractResolution/CustomizableSerializationContractResolver.cs (soon to have a home here: https://github.com/ghostsquad/Json.Net-CustomizableSerialization)

ghostsquad avatar Jun 02 '14 14:06 ghostsquad