You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a lot of implementations that would be good if all their bindings were named dynamically, pe. marking a class with a special attribute with the named instance. Currently, Named method only accepts string as a parameter, not a function like others that could use IContext. Is there a way to do what I'm trying to do currently with Ninject? Thank you.
this.Bind(
ctx =>{ctx.FromThisAssembly().SelectAllClasses().InheritedFrom<IReportGenerationManager>().WithAttribute<ReportPeriodicityAttribute>(attr =>attr.Value=="Monthly").BindToSelf().Configure(
syntax =>syntax.Named(/* I WANT HERE TO READ THE CLASS ATTRIBUTE TO NAME THE BINDING */).WithConstructorArgument("dataMartRepository",
ctxArg =>ctxArg.Kernel.Get<IDataMartRepository>("Monthly")));});
The text was updated successfully, but these errors were encountered:
I have a lot of implementations that would be good if all their bindings were named dynamically, pe. marking a class with a special attribute with the named instance. Currently, Named method only accepts string as a parameter, not a function like others that could use IContext. Is there a way to do what I'm trying to do currently with Ninject? Thank you.
The text was updated successfully, but these errors were encountered: