public IWebHookStore GetWebHookStore() { if (_webHookStore == null) { _webHookStore = CustomServices.GetStore(); } return(_webHookStore); }
public void It_Is_EpiWebHookStore() { HttpConfiguration config = new HttpConfiguration(); config.InitializeCustomWebHooksEPiServerStorage(); IWebHookStore actual = CustomServices.GetStore(); Assert.IsInstanceOf <EpiWebHookStore>(actual); }
private static IWebHookStore CreateStore() { HttpConfiguration config = new HttpConfiguration(); config.InitializeCustomWebHooksAzureStorage(); IWebHookStore store = CustomServices.GetStore(); Assert.IsType <AzureWebHookStore>(store); return(store); }
public void InitializeStore_SetsStore() { // Arrange HttpConfiguration config = new HttpConfiguration(); // Act config.InitializeCustomWebHooksAzureStorage(); IWebHookStore actual = CustomServices.GetStore(); // Assert Assert.IsType <AzureWebHookStore>(actual); }
public void Initialize_SetsStore_WithCustomSettings(string nameOrConnectionString, string schemaName, string tableName) { // Arrange HttpConfiguration config = new HttpConfiguration(); // Act config.InitializeCustomWebHooksSqlStorage(true, nameOrConnectionString, schemaName, tableName); IWebHookStore actual = CustomServices.GetStore(); // Assert Assert.IsType <SqlWebHookStore>(actual); }
public IWebHookManager GetHookManager() { if (_webHookManager == null) { ILogger logger = new TraceLogger(); IWebHookStore store = CustomServices.GetStore(); IWebHookSender sender = new ApiWebHookSender(logger); _webHookManager = new WebHookManager(store, sender, logger); } return(_webHookManager); }
public IWebHookManager GetHookManager() { if (_webHookManager == null || _webHookStore.GetType() != typeof(SqlWebHookStore)) { ILogger logger = new TraceLogger(); _webHookStore = CustomServices.GetStore(); IWebHookSender sender = new ApiWebHookSender(logger); _webHookManager = new WebHookManager(_webHookStore, sender, logger); } return(_webHookManager); }
public IWebHookStore GetWebHookStore() { if (_webHookStore == null) { var dataSettings = _configManagerHelper.DataSettings; Microsoft.AspNet.WebHooks.Config.SettingsDictionary settings = new Microsoft.AspNet.WebHooks.Config.SettingsDictionary(); settings.Add("MS_SqlStoreConnectionString", dataSettings.DataConnectionString); settings.Connections.Add("MS_SqlStoreConnectionString", new Microsoft.AspNet.WebHooks.Config.ConnectionSettings("MS_SqlStoreConnectionString", dataSettings.DataConnectionString)); Microsoft.AspNet.WebHooks.IWebHookStore store = new Microsoft.AspNet.WebHooks.SqlWebHookStore(settings, _logger); Microsoft.AspNet.WebHooks.Services.CustomServices.SetStore(store); _webHookStore = CustomServices.GetStore(); } return(_webHookStore); }
private static IWebHookStore CreateStore() { // Delete any existing DB string connectionString = ConfigurationManager.ConnectionStrings[WebHookStoreContext.ConnectionStringName].ConnectionString; Database.Delete(connectionString); // Initialize DB using code first migration var dbConfig = new EF.Configuration(); var migrator = new DbMigrator(dbConfig); migrator.Update(); HttpConfiguration config = new HttpConfiguration(); config.InitializeCustomWebHooksSqlStorage(encryptData: false); IWebHookStore store = CustomServices.GetStore(); Assert.IsType <SqlWebHookStore>(store); return(store); }
/// <summary> /// Gets an <see cref="IWebHookStore"/> implementation registered with the Dependency Injection engine /// or a default implementation if none are registered. /// </summary> /// <param name="services">The <see cref="IDependencyScope"/> implementation.</param> /// <returns>The registered <see cref="IWebHookStore"/> instance or a default implementation if none are registered.</returns> public static IWebHookStore GetStore(this IDependencyScope services) { IWebHookStore store = services.GetService <IWebHookStore>(); return(store ?? CustomServices.GetStore()); }