1

I'm playing around with structuremap.net and what I'm trying to do (I'm not sure if it possible or not) is loading type implementing specific interface and this type exist in assembly that's not refrence in my application, for example i want to drop new assembly in the application directory and configure the IOC container to load , currently i'm not using a configuration file i'm just testing the concept :)

Thanks in advance

1 Answer 1

1

It's possible to scan all Assemblies in the application directory:

ObjectFactory.Initialize(
    c => c.Scan( s => 
    {
        s.AssembliesFromBaseDirectory();
        s.AddAllTypesOf<IMyInterface>().NameBy(type => type.Name);
    })
);

or specific assemblies in a specific folder:

ObjectFactory.Initialize(
    c => c.Scan( s => 
    {
        s.AssembliesFromPath("thePath", assembly => assembly.GetName()
            .Name.Contains("Extension"));
        s.AddAllTypesOf<IMyInterface>();
    })
);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.