public void Register <TService>() where TService : new() { _container.AddService(typeof(TService), (c, t) => { return(new TService()); }); }
public static bool _AddService_System_ComponentModel_Design_ServiceContainer_System_Type_System_ComponentModel_Design_ServiceCreatorCallback_System_Boolean( ) { //class object System.ComponentModel.Design.ServiceContainer _System_ComponentModel_Design_ServiceContainer = new System.ComponentModel.Design.ServiceContainer(); //Parameters System.Type serviceType = null; System.ComponentModel.Design.ServiceCreatorCallback callback = null; System.Boolean promote = false; //Exception System.Exception exception_Real = null; System.Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType, callback, promote); } catch (System.Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType, callback, promote); } catch (System.Exception e) { exception_Intercepted = e; } return((exception_Real.Message == exception_Intercepted.Message)); }
public static bool _AddService_System_ComponentModel_Design_ServiceContainer_System_Type_System_Object( ) { //class object System.ComponentModel.Design.ServiceContainer _System_ComponentModel_Design_ServiceContainer = new System.ComponentModel.Design.ServiceContainer(); //Parameters System.Type serviceType = null; System.Object serviceInstance = null; //Exception System.Exception exception_Real = null; System.Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType, serviceInstance); } catch (System.Exception e) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType, serviceInstance); } catch (System.Exception e) { exception_Intercepted = e; } return((exception_Real.Message == exception_Intercepted.Message)); }
public static bool _AddService_System_ComponentModel_Design_ServiceContainer_System_Type_System_Object_System_Boolean( ) { //class object System.ComponentModel.Design.ServiceContainer _System_ComponentModel_Design_ServiceContainer = new System.ComponentModel.Design.ServiceContainer(); //Parameters System.Type serviceType = null; System.Object serviceInstance = null; System.Boolean promote = false; //Exception System.Exception exception_Real = null; System.Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType,serviceInstance,promote); } catch( System.Exception e ) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType,serviceInstance,promote); } catch( System.Exception e ) { exception_Intercepted = e; } return( ( exception_Real.Message == exception_Intercepted.Message )); }
public static bool _AddService_System_ComponentModel_Design_ServiceContainer_System_Type_System_ComponentModel_Design_ServiceCreatorCallback( ) { //class object System.ComponentModel.Design.ServiceContainer _System_ComponentModel_Design_ServiceContainer = new System.ComponentModel.Design.ServiceContainer(); //Parameters System.Type serviceType = null; System.ComponentModel.Design.ServiceCreatorCallback callback = null; //Exception System.Exception exception_Real = null; System.Exception exception_Intercepted = null; InterceptionMaintenance.disableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType,callback); } catch( System.Exception e ) { exception_Real = e; } InterceptionMaintenance.enableInterception( ); try { _System_ComponentModel_Design_ServiceContainer.AddService(serviceType,callback); } catch( System.Exception e ) { exception_Intercepted = e; } return( ( exception_Real.Message == exception_Intercepted.Message )); }
public virtual void OnBeginRequest(HttpContext context) { // put your application start code here //Configure Elmah SqlErrorLog Connection String var parent = Elmah.ServiceCenter.Current; Elmah.ServiceCenter.Current = webcontext => { var container = new System.ComponentModel.Design.ServiceContainer(parent(webcontext)); var log = new Elmah.SqlErrorLog(Global_config.DBConnectionString); container.AddService(typeof(Elmah.ErrorLog), log); return(container); }; //Configure Dynamic Configuration //DynamicConfigurationManager.Instance.ApplyConfiguration(HttpContext.Current); }
/// <summary>Initializes any data/resources on application start.</summary> /// <param name="context">The application context that instantiated and will be running this module.</param> public virtual void OnStart(HttpApplication context) { // put your application start code here //Note: In IIS 7 You need to configure managed pipeline mode to Classic mode only because Integrated mode do not allow Application_Start event to access HttpContext anymore //Configure Elmah SqlErrorLog Connection String var parent = Elmah.ServiceCenter.Current; Elmah.ServiceCenter.Current = webcontext => { var container = new System.ComponentModel.Design.ServiceContainer(parent(webcontext)); var log = new Elmah.SqlErrorLog(Global_config.DBConnectionString); container.AddService(typeof(Elmah.ErrorLog), log); return(container); }; //Configure Dynamic Configuration //DynamicConfigurationManager.Instance.ApplyConfiguration(HttpContext.Current); }
private DependencyService() { _container = new System.ComponentModel.Design.ServiceContainer(); _container.AddService(typeof(IServiceProvider), this); }