Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [ninject]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers

Add behaviours without changing existing code

I have a data access layer, which currently communicates with a database. public interface IDao<T> // T is my DTO { Write(IEnumerable<T> dtosToPersist) } public class Dao<T> : ...
Baguette's user avatar
3 votes
2 answers

Unit of work + repository pattern + dependency injection

I am in the process of refactoring and improving a codebase. One of the major missing features is transactional safety and certain errors arising from each repository having its own DbContext. The ...
Flater's user avatar
  • 51.7k
1 vote
1 answer

Manually disposing Entity Framework Context while using Ninject InRequestScope();

Spending some time sifting through documentation, I'm trying to figure out the best software architecture with or without the dispose pattern. I've built the Repository pattern many time over the ...
Tez Wingfield's user avatar
-1 votes
1 answer

Dependency injection - passing domain objects to underlying dependencies with NInject [closed]

I'm working on a larger project. I hope I understood DI well and based-on that I'm able to do this: // domain object holding configuration ata var input = new GeneratorInput { Constructions = new ...
Patrik Bak's user avatar
21 votes
7 answers

What is the "right" way to implement DI in .NET?

I'm looking to implement dependency injection in a relatively large application but have no experience in it. I studied the concept and a few implementations of IoC and dependency injectors available, ...
user3223738's user avatar
0 votes
1 answer

Dependency injection multiple instances or only one InrequestScope

I'm trying to understand what happens with dependencies (Ninject) when a same Interface in injected in multiple classes. I am specifying InRequestScope for my bindings so as I understand there should ...
Iztoksson's user avatar
  • 197
5 votes
4 answers

Does anyone have a good DI registration pattern?

I've done this so many times but I never end up liking how my code turns out. I'm asking if anyone else has the same problems and can offer solutions or conventions that they've used to make cleaner ...
Frank Bryce's user avatar
2 votes
1 answer

Using ninject in a class library

Looking for some help getting my head around ninject and DI. Using the simple examples I've found online everything works nicely but trying to do something more complex is causing headaches. I have ...
Flick's user avatar
  • 23
0 votes
1 answer

What is a good practical example demonstrating an architectural advantage in interface dependency injection

I need help (preferably by way of a practical example) to understand why/if the following implementation of IoC/DI (in this case using Ninject) provides an architectural advantage: using (IKernel ...
Chris Halcrow's user avatar
1 vote
1 answer

Ninject/DI: How to correctly pass initialisation data to injected type at runtime

I have the following two classes: public class StoreService : IStoreService { private IEmailService _emailService; public StoreService(IEmailService emailService) { _emailService ...
MrLane's user avatar
  • 629
0 votes
1 answer

How to apply IoC (or something similar) to a constant?

I have the following class with the following members: public class RegistrationPresenter : EPiPresenter<IRegistrationView, LoginPage>, IDisposable { private readonly static string[] ...
David Jiménez Martínez's user avatar
3 votes
0 answers

Manual dependency injection or abstract factory

We're starting to use dependency injection in a fairly large, interactive program. It's early yet, but I have a feeling that the majority of the objects being injected are going to want runtime data ...
donkey's user avatar
  • 139
4 votes
1 answer

Configuring DI in a decoupled app

I'm reading through Mark Seeman's Dependency Injection in .NET (excellent read so far) and something is escaping me. If the application's architecture is like [DAL] => [BLL] <= [UI], with the ...
Mathieu Guindon's user avatar
1 vote
1 answer

How can I bind an interface to a class decided by an xml or database configuration at the launch of the application?

I'm re-working on the design of an existing application which is build using WebForms. Currently the plan is to work it into a MVP pattern application while using Ninject as the IoC container. The ...
ipohfly's user avatar
  • 271
0 votes
1 answer

How to make Ninject inject an MVC view model?

How do I configure Ninject so it injects an instance in a view model? PS. It is an abstracted service to help with validation, so I am not trying to burden the model with too much responsibilities.
Boris Yankov's user avatar
  • 3,583