Bind(typeof(IRepository<>)).To(typeof(Repository<>));
This is the correct syntax for binding an open generic.
If you are receiving null back when requesting IRepository< of whatever >
, then there may be some other problem in an area of code you haven’t shared.
Related Contents:
- How do the major C# DI/IoC frameworks compare? [closed]
- Creating an instance using Ninject with additional parameters in the constructor
- NInject: Where do you keep your reference to the Kernel?
- How to avoid Dependency Injection constructor madness?
- .NET Core DI, ways of passing parameters to constructor
- Combining DI with constructor parameters?
- An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key
- How to use DI container when OwinStartup
- What is Ninject and when do you use it?
- What is the intention of Ninject modules?
- Is it better to create a singleton to access unity container or pass it through the application? [closed]
- Unable to update the EntitySet – because it has a DefiningQuery and no element exist
- Making a private method public to unit test it…good idea?
- What’s the strangest corner case you’ve seen in C# or .NET? [closed]
- When should I use double instead of decimal?
- C# vs Java Enum (for those new to C#)
- Class Diagrams in VS 2017
- How do I serialize a C# anonymous type to a JSON string?
- How does the C# compiler detect COM types?
- Unit testing that events are raised in C# (in order)
- Query an XDocument for elements by name at any depth
- C# DateTime to UTC Time without changing the time
- Set Viewbag before Redirect
- Get Current Area Name in View or Controller
- Changing the cursor in WPF sometimes works, sometimes doesn’t
- Are async console applications supported in .NET Core?
- Adjusting CommandTimeout in Dapper.NET?
- Using FileSystemWatcher to monitor a directory
- C# pattern to prevent an event handler hooked twice [duplicate]
- HTTP 404 when accessing .svc file in IIS
- How can I return a custom HTTP status code from a WCF REST method?
- How do I do pagination in ASP.NET MVC?
- What’s the difference between Bitmap.Clone() and new Bitmap(Bitmap)?
- Most performant way of checking empty strings in C# [closed]
- Regular Expression to split on spaces unless in quotes
- How do I convert a single char to a string?
- Can .NET load and parse a properties file equivalent to Java Properties class?
- How to detect a USB drive has been plugged in?
- ASP.NET MVC WebAPI 404 error
- Why am I getting ‘One or more types required to compile a dynamic expression cannot be found.’?
- How long will a C# lock wait, and what if the code crashes during the lock?
- Empty string as a special case?
- multimap in .NET
- How to get a distinct result with nHibernate and QueryOver API?
- Adding unknown (at design time) properties to an ExpandoObject
- Print Pdf in C# [closed]
- Creating one NuGet package from multiple projects in one solution
- variable ” of type ” referenced from scope ”, but it is not defined
- Binding property to control in Winforms
- How can I use multiple constructors to remove duplicated code while maintaining readability?