3

I just updated my application with Ninject 3. Changed the file in App_Start from NinjectMVC3 to NinijectWebCommon.cs. Moved my files, updated the DLLs.. Now I started getting this error:

"Error activating Dictionary{string, string} using conditional implicit self-binding of Dictionary{string, string} Provider returned null. Activation path: 4) Injection of dependency Dictionary{string, string} into parameter widgetSettings of constructor of type MapWidgetViewModel 3) Injection of dependency IDetailedSearchResultCollectionWidget into parameter mediaWidgets of constructor of type MediaSourcesViewModel 2) Injection of dependency ITabItem into parameter tabItems of constructor of type TabNavigationController 1) Request for TabNavigationController

Suggestions: 1) Ensure that the provider handles creation requests properly."

the code that generates it here:

public MediaSourcesViewModel(IEnumerable<IMediaSourcesDataProvider> dataProviders,
               IEnumerable<IDetailedSearchResultCollectionWidget> mediaWidgets,
               IMediaItemDetailsWidget itemDetailsWidget)
        {
        this.Description = "Source list";
            this.ActionName = "DisplaySourcesAsPartial";
            this.ControllerName = "MediaSources";
            this.DefaultType = "MediaManagement";

            _dataProviders = dataProviders;

            MediaWidgets = new List<IDetailedSearchResultCollectionWidget>();
            MediaWidgets.AddRange(mediaWidgets);         //Set Tab Info
            this.Name = "Sources";
        }

the MapWidgetViewModel class is defined as follows:

public class MapWidgetViewModel : IDetailedSearchResultCollectionWidget, IMapWidgetSettings
{
   //constructor:
   public MapWidgetViewModel(IEnumerable<IDetailedSearchResult> dataSet, 
          Dictionary<String,String> widgetSettings = null)
        {
            InitParentInterfaceProperties();
        }
}

finally bindings:

kernel.Bind<IDetailedSearchResultCollectionWidget>().To<MapWidgetViewModel>(); 

there is no

kernel.Bind<MapWidgetViewModel>().ToSelf();

thanks for any ideas how to resolve this issue.

thanks a lot!

Alex

HotFrost
  • 1,595
  • 4
  • 17
  • 25

1 Answers1

4

ok.. found the answer that helped.. Here it is: Using default parameter values with Ninject 3.0

just need to override the settings: kernel.Settings.AllowNullInjection = true;

thanks, Al

Community
  • 1
  • 1
HotFrost
  • 1,595
  • 4
  • 17
  • 25