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

  • Home
  • SEARCH
  • 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 8736781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:22:21+00:00 2026-06-13T10:22:21+00:00

I have a controller which contains a few private read only interface properties which

  • 0

I have a controller which contains a few private read only interface properties which it needs in order to get data by calling a service which is then used to populate models etc

private readonly ISomeInterface _someObject;

Which gets set in the Controllers constructor:

public ... (ISomeInterface someInterface, ...) {
...
_someObject = someObject
}

_someObject is then used in a call to the service layer to get data.

I had to add another property to the controller but now when I build the soloution I get the following error:

CA1506 : Microsoft.Maintainability : 'ControllerName' is coupled with 87 different types from 30 different namespaces. Rewrite or refactor this class's methods to decrease its class coupling, or consider moving some of the class's methods to some of the other types it is tightly coupled with.

It asks me to reduce the coupling of the class, I understand that one way of doing this is to code against interfaces (abstractions) – which I’m already doing by adding the interface property? It seems by adding one more property it takes it past the threshold for flagging up this error.

If I remove it, I can’t get the data I need? What do I need to modify?

  • 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-13T10:22:22+00:00Added an answer on June 13, 2026 at 10:22 am

    How many actions does your controller have? Do you have a view model for each action? Do you have an input model for each action? Are you interacting with different classes for each controller action? You may need to split your controller up into multiple controllers to make it do less giving it fewer reasons to change and also fewer dependencies. Although using an interface would decouple the controller from the specific implementation of ISomeInterface it doesn’t do anything in terms of that warning. Changing to using the Interface didn’t reduce the number of types… it just changed from concrete type to an interface type.

    The problem is warning against having one class that does many many things. Having many dependencies suggests the class is doing too much and should be divided up. For example if this controller has say an action for “Bake Pie” and “Eat Pie” and “Make Ice Cream” and “Deliver food” you could move “deliver food” to a brand new class… you could break out the Make Ice Cream as well and then you would evaluate if Bake Pie and Eat Pie should stay together in the same class or be put in separate classes. The pies debate opens a can of worms which folks would debate.

    see: SOLID (object-oriented design)

    Do you have code that has to call 2 or more different data access classes that then calls another class to to create a view model. You could move that whole operation to a new class thus reducing your dependency on 3 classes down to 1.

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

Sidebar

Related Questions

I have a view controller which contains a UISearchBar @interface TradeFindHeaderViewController_iPhone : UIViewController {
i have view controller which contains a button which show the image library ,if
I have an controller which is an ArrayProxy and contains some computed arrays. In
I have an object which contains quite a few other objects in an IList
I have a view controller which contains a scroll view. Inside the scroll view
I have a tab controller, which contains a navigation controller which again contains a
I have UITabbarMoreController which contains a few UINavigationControllers. These UINavigationControllers then contain my custom
I have one view controller which contains two views (redView, blueView). The views are
I am using a view Controller which have contains tabbarcontroller(4 tabs). each tabbar have
I have a view controller which contains a table view, and which is wrapped

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.