TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kazek Wichura
NA
69
0
.NetCore dependency injection and optional params on assembly scanning
Sep 4 2020 1:10 PM
With 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
Reply
Answers (
1
)
Why do I copy Table1 contents to Table with the error ?
how to check a table is empty and if it is empty drop table?