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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:47:20+00:00 2026-06-14T08:47:20+00:00

I have a web application made in asp.net mvc, and i am using Ninject

  • 0

I have a web application made in asp.net mvc, and i am using Ninject to bind the interfaces.

For now, i have this:

// Db Context
kernel.Bind<DbContext>().To<DbEntities>().InRequestScope();

// Repositories - which are using instance of DbEntities
kernel.Bind<ICustomerRepository>().To<CustomerRepository>();
kernel.Bind<IProductRepository>().To<ProductRepository>();

// Services - which are using instances of Repositories
kernel.Bind<ICustomerService>().To<CustomerService>();
kernel.Bind<IProductService>().To<ProductService>();

I am binding an DbContext to DbEntities in RequestScope because i want to use the same DbContext in the same web request. After that it should dispose it.

But how the other bindings should be? How they are by default?

For example IProductRepository which has an instance of DbContext (which is one per request), should also be InRequestScope() ?

IProductService has an instance of IProductRepository

How the bindings should be so is suitable for a web application? (and i don’t overload the server’s memory)

  • 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-14T08:47:21+00:00Added an answer on June 14, 2026 at 8:47 am

    For MVC application your configuration is ok. There will be no big difference if you bind your repositories in the default transient scope or in the request scope. As @Mark stated in the transient scope your dependencies will be injected as new instances of bounded objects, but in transaction scope they will be created once per request. I prefer little bit more Request scope and recommend it if you want to do (for example) some per-request caching on your repository.

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

Sidebar

Related Questions

Now, I have a web application made using [html, asp.net, sql server,javascript & ajax].
I have to migrate a web application I made with ASP.NET MVC to a
I have a Web application made in ASP.NET and MS SQL 2005 as database
For the web application (ASP.NET MVC) I'm currently developing, we have the following architecture
I have made a MVC application that uses the built-in ASP.NET login functions. It
In VS 2010, I have an asp.net web application project. I made a change
I have just made a step back from ASP .NET MVC application and moved
I have a web application made in ASP.Net. Well, I have a few jquery
I have previously only made web applications in Asp.Net MVC, and there you can
I have an asp.net web application that I made in Visual Studio 2008. Everything

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.