dependency injection - Why does ComposeExportedValue not insert my object into the container? -


i have following line of code seems nothing @ all, no errors, nothing. object not in container's catalog:

public void initialize() {   if (authenticationmodel.current.protocol.tostring() != gettype().name.replace(unittypesuffix, ""))   {     return;   }   _container.composeexportedvalue<iloginview>(new loginview()); } 

the if check because potentially have more 1 login module, , 1 specified protocol must make it's view available in container. other dynamically loaded modules can ask login view registered. check passes , composeexportedvalue executes, object not visible in container.

if this, see use login view, when composes test object:

public class test {     [import]     public iloginview loginview { get; set; } }  var test = new test(); container.composeexportedvalue<iloginview>(new loginview()); container.satisfyimportsonce(test); 

the documentation not detailed, think not added container because created object, , keep ownership of it. not disposed when container gets disposed etc.

if want part of container have use either attributes [export] , add assembly contains view catalog. or if don't want use attributes, can use new registrationbuilder.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -