c# - Specify more than one rule in ValueInjecter's ConventionInjection(s) -


i'm new valueinjecter. knew how match properties same name different caps:

public class ignorecaseinjection : conventioninjection {      protected override bool match(conventioninfo c)      {          return string.compare(c.sourceprop.name, c.targetprop.name,                                 stringcomparison.ordinalignorecase) == 0;      } } 

and:

var foo = new foo() { id = 1}; var bar = new bar(); bar.injectfrom<ignorecaseinjection>(foo); 

this map foo.id bar.id. if have properties mapped using different rule? example, have foo.myprop (which enumerable of type fooenum) want map bar.myprop string (i mean store .tostring() representation of enum).

how can add rule converter? how code like?

so far, found solution in valueinjecter's documentation:

viewmodel.injectfrom(entity)                 .injectfrom<countrytolookup>(entity)                 .injectfrom<anythingelseyoumightimagine>(entity)                 .injectfrom(new stuffinjection(stuffrepository), anotherentity);  

and have code each of classes , make sure don't overlap


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -