Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3984278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:45:01+00:00 2026-05-20T05:45:01+00:00

Long post – sorry…. I’m doing input validation for a WCF service and using

  • 0

Long post – sorry….

I’m doing input validation for a WCF service and using StructureMap IoC to instantiate the appropriate validation objects.
I have 2 different validation groups:

  1. Per object validation: means that one input parameter, will be resolve by the Ioc (e.g. Ioc.ResolveAll<IValidatorObject<InputParameter1>, …. <InputParameter2>… etc). If any rules are found, the validate method is invoked.
  2. Per context validation: mean that validation rules are invoked, based on the current context (explicit roles). A context could be ‘deposit money’ or ‘open bank account’. Context validation are usually dependent on 2 or more of the input parameters and is the key difference between object and context validation.

The input validation is performed in the BeforeCall event call in the IParameterInspector (provider/server side!). With this event I get a string containing the operation name (aka. the context) and an object[] with the input parameters.

The problem is that there’s multiple validation rules for a single context and the only way I have figured out to register the context in the Ioc, is by using named intances. However I can only register 1 named instance pr. interface. And the interface is not uniquely identifiable by its signature. E.g.

  • Context rule for ‘create account’: IValidatorContext<User, Account>
  • Context rule for ‘deposit money’: IValidatorContext<User, Account>

So my question is, whether it is possible to register the context in StructureMap in any other way than named instances – or maybe a way to group named instances.

An alternative route, is to implement explicit interfaces for each context, so that the DepositMoney service method might look like this:

public Response Deposit(IDepositMoney inputArguements)

where IDepositMoney contains the input parameters.

So am I way off here, or can I somehow register a context in StructureMap? Or should I just go ahead and use explicit interface instead (3rd option?)

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:45:02+00:00Added an answer on May 20, 2026 at 5:45 am

    Ended up wrapping each set of input parameters in a context and used the context to register in StructureMap. Works like a charm!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for the long post that follows. I know that it is not a
Sorry for this long post. The question is however small but requires full detail.
Hello (this is a long post sorry), I am writing a application in ASP.NET
Sorry for the long post, but most of it is code spelling out my
Long post.. sorry I've been reading up on this and tried back and forth
(Sorry for long post) Ok guys, so I'm having some issues with something I'm
this post is a long one sorry for that but the problem is complex
Apologies for the long post, but I wonder if I could get some more
I apologize in advance for the long post... I used to be able to
This is a relatively long post. F# has a matrix and vector type(in PowerPack

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.