Skip to content

Instantly share code, notes, and snippets.

@rauhryan
Created March 29, 2011 20:54
Show Gist options
  • Save rauhryan/893261 to your computer and use it in GitHub Desktop.
Save rauhryan/893261 to your computer and use it in GitHub Desktop.
Guice vs StructureMap
public class BillingModule extends AbstractModule {
@Override
protected void configure() {
bind(TransactionLog.class).to(DatabaseTransactionLog.class);
bind(CreditCardProcessor.class).to(PaypalCreditCardProcessor.class);
bind(BillingService.class).to(RealBillingService.class);
}
}
public class SweetVidsWebRegistry : Registry
{
public SweetVidsWebRegistry()
{
Scan(x =>
{
x.TheCallingAssembly();
x.WithDefaultConventions();
x.AddAllTypesOf<IStartable>();
}
);
For<HttpContextBase>().Use(ctx => new HttpContextWrapper(HttpContext.Current));
For<HttpRequestBase>().Use(ctx => new HttpRequestWrapper(HttpContext.Current.Request));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment