wcf - StructureMap grouping of named instances -


long post - sorry....

i'm doing input validation wcf service , using structuremap ioc instantiate appropriate validation objects. have 2 different validation groups:

  1. per object validation: means 1 input parameter, resolve ioc (e.g. ioc.resolveall<ivalidatorobject<inputparameter1>, .... <inputparameter2>... etc). if rules found, validate method invoked.
  2. per context validation: mean validation rules invoked, based on current context (explicit roles). context 'deposit money' or 'open bank account'. context validation dependent on 2 or more of input parameters , key difference between object , context validation.

the input validation performed in beforecall event call in iparameterinspector (provider/server side!). event string containing operation name (aka. context) , object[] input parameters.

the problem there's multiple validation rules single context , way have figured out register context in ioc, using named intances. can register 1 named instance pr. interface. , interface not uniquely identifiable signature. e.g.

  • context rule 'create account': ivalidatorcontext<user, account>
  • context rule 'deposit money': ivalidatorcontext<user, account>

so question is, whether possible register context in structuremap in other way named instances - or maybe way group named instances.

an alternative route, implement explicit interfaces each context, depositmoney service method might this:

public response deposit(idepositmoney inputarguements) 

where idepositmoney contains input parameters.

so way off here, or can somehow register context in structuremap? or should go ahead , use explicit interface instead (3rd option?)

thanks in advance

ended wrapping each set of input parameters in context , used context register in structuremap. works charm!


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -