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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:05:45+00:00 2026-05-26T10:05:45+00:00

I am using Ninject with ASP.NET MVC. Basically, I want to pass the protected

  • 0

I am using Ninject with ASP.NET MVC. Basically, I want to pass the protected member _connectionStringBuilder in the BaseController class as a constructor argument to the class SourceCodeManager.

I basically do some processing at the controller level and then I want to pass that to the my various Business layer classes like SourceCodeManager.

I know this sounds a bit funky, but I basically want to pass the same variable _connectionStringBuilder to all of my Business Layer classes.
(I am trying to upgrade a classic ASP application where they store the username and password in cookies!)

 public class SourceCodeManager :  ParisDataAccessManager, ISourceCodeManager
    {
        SourceCodeManager(IParisConnectionStringBuilder connectionStringBuilder)
            : base(connectionStringBuilder)
        {

        }

        public List<SourceCodeList> GetManualSourceCodes()
        {
            using (var connection = new SqlConnection(connectionStringManager.GetConnectionString()))
            {
                connection.Open();
                var manualSourcesCodes = connection
                    .Query<SourceCodeList>("select source_cd, source_desc where feeder_system_cd = 'ME'")
                    .ToList();
                return manualSourcesCodes;
            }
        }
    }

public class BaseController : Controller
{
    [Inject]
    public IParisConnectionStringBuilder _connectionStringBuilder { get; set; }
    // ...
}
  • 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-26T10:05:46+00:00Added an answer on May 26, 2026 at 10:05 am

    I’m not 100% I understand what your question is.

    However, if you only want a single instance of IParisConnectionStringBuilder in your whole application, look at registering as a singleton in NInject.

    Syntax is something like:

    Bind<IParisConnectionStringBuilder>().To<ParisConnectionStringBuilder>().InSingletonScope();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using asp.net mvc 3. I am using ninject 2.2.1.0 protected void Application_Start()
We are using ASP.net MVC. Which of these is the best DI framework Ninject
I am using ASP.NET MVC 3 + Ninject in my application which works great
I'm using Ninject 2 with an ASP.NET MVC web app. All the dependencies are
I am using asp.net mvc 3, ninject 2.0 and the ninject mvc 3 plugin.
I've got a simple web application using ASP.NET MVC3 and Ninject.Web.MVC (the MVC3 version).
I am building an application using Ninject and ASP.NET MVC 3. Is it possible
I am using Ninject 2 with Asp.Net MVC 3. I have following module. public
I am using NHibernate and ninject in ASP.Net MVC, using this page as a
I'm using SolrNet.0.3.1 and SolrNet.Ninject.0.3.1 in an ASP.NET MVC 3 app pointing to a

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.