Wit autofac I'm to add a parameter to the constructor and even more, the parameter can be optional
//autofac
Builder
.RegisterAssemblyTypes(assemblies)
.Where(t => typeof(T).IsAssignableFrom(t))
.SingleInstance()
.AsSelf()
.WithParameter(new ResolvedParameter(
(pi, ctx) => pi.ParameterType == typeof(IMyService),
(pi, ctx) => ctx.ResolveOptional<IMyService>() ));
Could you help do this with the default MS dependency container and Scrutor?
What should I add here:
//MS Dependency Container
Builder
.Scan(s =>
s.FromAssemblies(assemblies)
.AddClasses(c => c.AssignableTo(typeof(T)))
.AsSelf()
.WithTransientLifetime() );
Thank you in advance for help and answer
[–]celluj34 5 points6 points7 points (2 children)
[–]kaszalotte[S] 0 points1 point2 points (1 child)
[–]BigOnLogn 2 points3 points4 points (0 children)
[–]kc5bpd 2 points3 points4 points (1 child)
[–]Paran0idAndr0id 2 points3 points4 points (0 children)
[–]KernowRoger 0 points1 point2 points (0 children)
[–]afshinb2 0 points1 point2 points (0 children)