Created
March 29, 2011 20:54
-
-
Save rauhryan/893261 to your computer and use it in GitHub Desktop.
Guice vs StructureMap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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