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 8004305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:52:44+00:00 2026-06-04T16:52:44+00:00

Using ASP.NET MVC I am able to replace the FilterProvider as so var oldProvider

  • 0

Using ASP.NET MVC I am able to replace the FilterProvider as so

 var oldProvider = FilterProviders.Providers.Single(f => f is FilterAttributeFilterProvider);
 FilterProviders.Providers.Remove(oldProvider);
 FilterProviders.Providers.Add(new CustomFilterProvider(_container));

Using my own custom provider. It does not give me the ability to use a factory pattern to create the controller filter attributes but I do get the ability to use property injection to set dependencies the attributes may need using the container.

Is it possible to do something similar using WCF so that I can inject dependencies (property injection is fine) into my user defined classes that derive from Attribute that I use on my service methods (the services are created using IOC)?

I am using CastleWindsors WcfFacility, but a generalised solution (that applied to any container) would probably be a better answer.

  • 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-06-04T16:52:45+00:00Added an answer on June 4, 2026 at 4:52 pm

    One way to do this is to use the containers OnCreate method or similar and do something like the following at registration

      Container.Register(Component.For<IMyService>().ImplementedBy<MyService>().OnCreate(WireUpAttibutes).LifeStyle.Transient);
    

    then have the following methods

      private static void WireUpAttibutes<T>(IKernel kernel, T instance) {
         var attributes = instance.GetType().GetCustomAttributes(typeof(MyAttribute), false);
         foreach (var attribute in attributes) {
            WireUp(kernel, attribute.GetType(), attribute);
         }
      }
    
      private static void WireUp(IKernel kernel, Type type, object instance) {
         var properties = type.GetProperties().Where(p => p.CanWrite && p.PropertyType.IsPublic);
         foreach (var propertyInfo in properties.Where(propertyInfo => kernel.HasComponent(propertyInfo.PropertyType))) {
            propertyInfo.SetValue(instance, kernel.Resolve(propertyInfo.PropertyType), null);
         }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using an asp.net mvc 3 project. I want to be able to email
I am using ASP.NET MVC application. However I am not able to understand the
I am using asp.net MVC 3, and I am trying to remove a LI
Using ASP.Net MVC on my Site.Master I have: <head runat=server> <title><asp:ContentPlaceHolder ID=TitleContent runat=server />
Using ASP.NET MVC when trying to get the information stored on my Session[objectName] from
Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on
Using ASP.NET MVC + jQuery : I need to use some values owned by
Using ASP.Net MVC 2, is there any way to use the RedirectToAction() method of
I am using Asp.net MVC 3 and Json.net library. I have view model class
I'm using ASP.NET MVC 3 and DataAnnotations validations and for some reason the javascript

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.