public WindsorControllerFactory() { container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); }
public WindsorControllerFactory() { container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) { container.AddComponentWithLifestyle(t.FullName, t, Castle.Core.LifestyleType.Transient); } }
// The constructor: // 1. Sets up a new IoC container // 2. Registers all components specified in web.config // 3. Registers all controller types as components public WindsorControllerFactory() { // Instantiate a container, taking configuration from web.config container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); // Also register all the controller types as transient var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); }
protected void Application_Start(object sender, EventArgs e) { IWindsorContainer container = new WindsorContainer(); // Register components in code // For XML component registration, see Fire Eagle consumer example container.AddComponentWithLifestyle<ISigningProvider, HmacSha1SigningProvider>( "signing.provider:HMAC-SHA1", LifestyleType.Thread); container.AddComponent<INonceProvider, GuidNonceProvider>(); container.AddComponentWithLifestyle<IRequestStateStore, SessionRequestStateStore>(LifestyleType.Singleton); WindsorServiceLocator injector = new WindsorServiceLocator(container); ServiceLocator.SetLocatorProvider(() => injector); // There is a bug(?) with Twitter's servers at the moment where // POSTing with an Expect header will cause a 417 Expectation Failed // The below prevents .NET from sending Expect headers for all POST // requests in this AppDomain // (see: http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7c67ff1a2407dee7) ServicePointManager.Expect100Continue = false; }
protected void Application_Start(object sender, EventArgs e) { IWindsorContainer container = new WindsorContainer(); // Register components in code // For XML component registration, see Fire Eagle consumer example container.AddComponentWithLifestyle <ISigningProvider, HmacSha1SigningProvider>( "signing.provider:HMAC-SHA1", LifestyleType.Thread); container.AddComponent <INonceProvider, GuidNonceProvider>(); container.AddComponentWithLifestyle <IRequestStateStore, SessionRequestStateStore>(LifestyleType.Singleton); WindsorServiceLocator injector = new WindsorServiceLocator(container); ServiceLocator.SetLocatorProvider(() => injector); // There is a bug(?) with Twitter's servers at the moment where // POSTing with an Expect header will cause a 417 Expectation Failed // The below prevents .NET from sending Expect headers for all POST // requests in this AppDomain // (see: http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7c67ff1a2407dee7) ServicePointManager.Expect100Continue = false; }
// The constructor: // 1. Sets up a new IoC container // 2. Registers all components specified in web.config // 3. Registers all controller types as components public WindsorControllerFactory() { // Instantiate a container, taking configuration from web.config container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle"))); // Also register all the controller types as transient var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes() where typeof(IController).IsAssignableFrom(t) select t; foreach (Type t in controllerTypes) { container.AddComponentWithLifestyle(t.FullName, t, LifestyleType.Transient); } }