Questions tagged [ninject]
The ninject tag has no usage guidance.
15 questions
1
vote
2
answers
171
views
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> : ...
3
votes
2
answers
3k
views
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 ...
1
vote
1
answer
2k
views
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 ...
-1
votes
1
answer
157
views
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 ...
21
votes
7
answers
16k
views
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, ...
0
votes
1
answer
3k
views
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 ...
5
votes
4
answers
2k
views
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 ...
2
votes
1
answer
4k
views
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 ...
0
votes
1
answer
392
views
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 ...
1
vote
1
answer
5k
views
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 ...
0
votes
1
answer
169
views
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[] ...
3
votes
0
answers
360
views
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 ...
4
votes
1
answer
1k
views
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 ...
1
vote
1
answer
988
views
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 ...
0
votes
1
answer
2k
views
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.