/// <summary> /// Add in Global.Application_Start (Static Mode) /// </summary> /// <param name="app"></param> /// <param name="configureOptions"></param> /// <returns></returns> public static HttpApplication AddJsonQLTester(this HttpApplication app, Action <JsonQLTesterOptions> configureOptions = null) { jsonQLTesterOptions = new JsonQLTesterOptions(); configureOptions?.Invoke(jsonQLTesterOptions); jsonQLTesterSchemaMIddleware = new JsonQLTesterSchemaMIddleware(jsonQLTesterOptions); jsonQLTesterRedirectMiddleware = new JsonQLTesterRedirectMiddleware(jsonQLTesterOptions); jsonQLTesterEmbeddedMIddleware = new JsonQLTesterEmbeddedMIddleware(jsonQLTesterOptions); return(app); }
/// <summary> /// Add in Global.Application_Start (Use DI) /// </summary> /// <param name="app"></param> /// <param name="registerServiceType"></param> /// <param name="registerServiceInstance"></param> /// <param name="configureOptions"></param> /// <returns></returns> public static HttpApplication AddJsonQLTester(this HttpApplication app, Action <Type, string> registerServiceType, Action <object, string> registerServiceInstance, Action <JsonQLTesterOptions> configureOptions = null) { var jsonQLTesterOptions = new JsonQLTesterOptions(); configureOptions?.Invoke(jsonQLTesterOptions); registerServiceInstance.Invoke(jsonQLTesterOptions, "Singleton"); registerServiceType.Invoke(typeof(JsonQLTesterSchemaMIddleware), "Singleton"); registerServiceType.Invoke(typeof(JsonQLTesterRedirectMiddleware), "Singleton"); registerServiceType.Invoke(typeof(JsonQLTesterEmbeddedMIddleware), "Singleton"); return(app); }