c# - Configuration Options in .net core -


how lambda options work services.add* in .net core?

i following services.configure,

services.configure<myoptions>(   configuration.getsection("my-option-section-in-appsettings.json")); 

or lambda variant,

services.configure<myoptions>(options => {      options.propertyname = "some-thing" } 

but when comes following, i'm lost,

services.addmyservice(options => options.usemethod1(...)); 

i tried traversing code above used, fail find way through. quickest example can here

how lambda options work services.add* in .net core?

the common pattern add expression satisfies action<toptions> delegate. toptions object corresponds add function, gives consumer opportunity update object, setting values or invoking methods see fit. action<toptions> executed part of service's lifetime. example when adding mvc .addmvc extension method framework invoke action prior service being available consumption. specific example, of underlying mvc services registered , options object instantiated , given act on.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -