Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created April 26, 2012 13:57
Show Gist options
  • Select an option

  • Save emiaj/2499808 to your computer and use it in GitHub Desktop.

Select an option

Save emiaj/2499808 to your computer and use it in GitHub Desktop.
var foo = new ObjectDef(typeof(Foo)); // you can also target a value instead of a type (new Foo())
foo.DependencyByType(typeof(IBar), typeof(Bar)); // by type
foo.DependencyByValue(typeof(IBaz), new Baz()); // by value
Services(x =>
{
x.AddService(typeof(IFoo), foo);
});
@uluhonolulu

Copy link
Copy Markdown

Would that work in a test assembly? I mean, without the full bootstrapping. What it has is just:

        var registry = new FubuRegistry();
        ClassUnderTest.As<IFubuRegistryExtension>().Configure(registry);
        _services = registry.BuildLightGraph().Services;

So, if I even add an IActivator, would it be.. activated?

@emiaj

emiaj commented Apr 26, 2012

Copy link
Copy Markdown
Author

Uhmm, in that case you need to walk through the services. I think it accepts a visitor so you can evaluate the plugin graph by yourself, but the rules dictating if is or if is not a valid plugin would be up to you.
If you also want to check that in your live app, you can also use an activator, just take in the BehaviorGraph which is IoC enabled in fubu and do the same check you do in your tests.
You probably are better asking this to JDM, he may give you a proper advice ;)

@uluhonolulu

Copy link
Copy Markdown

Ok, thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment