Click here to Skip to main content
15,881,204 members
Home / Discussions / C#
   

C#

 
GeneralRe: .Net Core Windows App, using database repositories Pin
jkirkerx5-Sep-20 7:32
professionaljkirkerx5-Sep-20 7:32 
GeneralRe: .Net Core Windows App, using database repositories Pin
Gerry Schmitz5-Sep-20 8:46
mveGerry Schmitz5-Sep-20 8:46 
AnswerRe: .Net Core Windows App, using database repositories Pin
Richard Deeming6-Sep-20 22:30
mveRichard Deeming6-Sep-20 22:30 
GeneralRe: .Net Core Windows App, using database repositories Pin
jkirkerx7-Sep-20 6:58
professionaljkirkerx7-Sep-20 6:58 
GeneralRe: .Net Core Windows App, using database repositories Pin
jkirkerx7-Sep-20 9:14
professionaljkirkerx7-Sep-20 9:14 
GeneralRe: .Net Core Windows App, using database repositories Pin
jkirkerx7-Sep-20 10:29
professionaljkirkerx7-Sep-20 10:29 
GeneralRe: .Net Core Windows App, using database repositories Pin
jkirkerx7-Sep-20 12:12
professionaljkirkerx7-Sep-20 12:12 
Question.NetCore dependency injection and optional params on assembly scanning Pin
Member 148747204-Sep-20 8:17
Member 148747204-Sep-20 8:17 
With autofac I'm to add a parameter to the constructor and even more, the parameter can be optional

C#
//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:

<pre lang="c#">//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
AnswerRe: .NetCore dependency injection and optional params on assembly scanning Pin
Richard Deeming6-Sep-20 22:23
mveRichard Deeming6-Sep-20 22:23 
QuestionHow to create a method in a User control Pin
Ismael_19994-Sep-20 7:49
Ismael_19994-Sep-20 7:49 
AnswerRe: How to create a method in a User control Pin
Mycroft Holmes4-Sep-20 12:08
professionalMycroft Holmes4-Sep-20 12:08 
GeneralRe: How to create a method in a User control Pin
Ismael_19995-Sep-20 7:34
Ismael_19995-Sep-20 7:34 
AnswerRe: How to create a method in a User control Pin
Ralf Meier4-Sep-20 21:18
mveRalf Meier4-Sep-20 21:18 
GeneralRe: How to create a method in a User control Pin
Ismael_19995-Sep-20 7:33
Ismael_19995-Sep-20 7:33 
AnswerRe: How to create a method in a User control Pin
Ralf Meier5-Sep-20 12:11
mveRalf Meier5-Sep-20 12:11 
GeneralRe: How to create a method in a User control Pin
Ismael_19995-Sep-20 12:41
Ismael_19995-Sep-20 12:41 
AnswerRe: How to create a method in a User control Pin
Ralf Meier6-Sep-20 2:29
mveRalf Meier6-Sep-20 2:29 
GeneralRe: How to create a method in a User control Pin
Ismael_19996-Sep-20 5:37
Ismael_19996-Sep-20 5:37 
GeneralRe: How to create a method in a User control Pin
Ralf Meier6-Sep-20 9:34
mveRalf Meier6-Sep-20 9:34 
GeneralRe: How to create a method in a User control Pin
Ismael_19996-Sep-20 16:25
Ismael_19996-Sep-20 16:25 
QuestionCannot Create and Return an Instance of a Class Pin
Liagapi3-Sep-20 21:52
Liagapi3-Sep-20 21:52 
AnswerRe: Cannot Create and Return an Instance of a Class Pin
Richard Deeming3-Sep-20 22:05
mveRichard Deeming3-Sep-20 22:05 
GeneralRe: Cannot Create and Return an Instance of a Class Pin
Richard MacCutchan3-Sep-20 22:29
mveRichard MacCutchan3-Sep-20 22:29 
GeneralRe: Cannot Create and Return an Instance of a Class Pin
Richard Deeming4-Sep-20 3:10
mveRichard Deeming4-Sep-20 3:10 
QuestionProper Error handling Pin
Exoskeletor3-Sep-20 12:11
Exoskeletor3-Sep-20 12:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.