2013-04-30 85 views

回答

5

您需要創建自己的ConventionInjection,你比較屬性名稱的情況下insensitivly:

public class IgnoreCaseInjection : ConventionInjection 
{ 
    protected override bool Match(ConventionInfo c) 
    { 
     return String.Compare(c.SourceProp.Name, c.TargetProp.Name, 
           StringComparison.OrdinalIgnoreCase) == 0; 
    } 
} 

而且你需要與

var foo = new Foo() { ID = 1}; 
var bar = new Bar(); 
bar.InjectFrom<IgnoreCaseInjection>(foo); 
使用