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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:56:22+00:00 2026-05-23T04:56:22+00:00

Is Kernel.Get() threadsafe? My goal is share an instance of my kernel among all

  • 0

Is Kernel.Get() threadsafe? My goal is share an instance of my kernel among all my componenets and they may all very well call Kernel.Get() at the same time on different threads.

Is Kernel.Get() thread safe?

What is the best pattern to share the application kernel among all application components which are sitting in different dll’s? I prefer not to pass an instance of a factory to every component of my application if this makes sense.

  • 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-23T04:56:23+00:00Added an answer on May 23, 2026 at 4:56 am

    Get is threadsafe but creating new kernel instances (ctor) is currently not threadsafe.

    Generally you should try to minimize your access to the kernel to an absolute minimum. Accessing the kernel form everywhere is a very bad design and makes your code much less reusable. See Service Locator Antipattern

    The only situations where you access the kernel should be:

    • Once in the composite root of the application (e.g. Program.Main, App.xaml, MVC Controller creation)
    • Inside a factory if you don’t know how many instances you need when the composite root is created
    • Inside a factory if you don’t know which implementation is required when the composite root is created
    • Inside a factory if you need to create a component late due to memory/resource constraints.

    In all cases limit the access to the kernel to the composite root and inject factories (class or Func<T>) to the classes where you need to create objects during runtime. The best way to give those factories access to the kernel is still constructor injection even if you do not prefer doing so. Or use Func<T> ( Does Ninject support Func (auto generated factory)? ).

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

Sidebar

Related Questions

If I define a binding in ninject with ReqeustScope() , and then call Kernel.Get<T>
How to use this functionality in ninject 2.0? MyType obj = kernel.Get<MyType>(With.Parameters.ConstructorArgument(foo,bar)); The With
I'm trying to get a kernel module to load at boot. If I run
I'm following several tutorials and references trying to get my kernel set up. I've
I am looking to get into operating system kernel development and figured my contribution
I am looking to get into operating system kernel development and figured and have
How can I get page faults statistics from kernel for my application while it
How to get the Kenel time of an opertaion for eg: networking, disk I/O
Kernel threads do context switch at kernel level instead of process level. I am
I'm working on kernel design, and I've got some questions concerning paging. The basic

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.