Remove ISessionStore.Connect in raction to removal of IDistrbutedCache.Connect.

This commit is contained in:
Chris R 2016-01-25 13:56:14 -08:00
parent ea0c57122d
commit 8b29de8993
4 changed files with 1 additions and 44 deletions

View File

@ -37,11 +37,6 @@ namespace Microsoft.AspNetCore.Session
} }
} }
public void Connect()
{
_cache.Connect();
}
public ISession Create(string sessionId, TimeSpan idleTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey) public ISession Create(string sessionId, TimeSpan idleTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey)
{ {
if (string.IsNullOrEmpty(sessionId)) if (string.IsNullOrEmpty(sessionId))

View File

@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Session
public interface ISessionStore public interface ISessionStore
{ {
bool IsAvailable { get; } bool IsAvailable { get; }
void Connect();
ISession Create(string sessionId, TimeSpan idleTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey); ISession Create(string sessionId, TimeSpan idleTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey);
} }
} }

View File

@ -62,7 +62,6 @@ namespace Microsoft.AspNetCore.Session
_logger = loggerFactory.CreateLogger<SessionMiddleware>(); _logger = loggerFactory.CreateLogger<SessionMiddleware>();
_options = options.Value; _options = options.Value;
_sessionStore = sessionStore; _sessionStore = sessionStore;
_sessionStore.Connect();
} }
/// <summary> /// <summary>

View File

@ -459,33 +459,6 @@ namespace Microsoft.AspNetCore.Session
} }
} }
[Fact]
public async Task SessionMiddleware_DoesNotStart_IfUnderlyingStoreIsUnavailable()
{
// Arrange, Act & Assert
var exception = await Assert.ThrowsAsync<InvalidOperationException>(async () =>
{
var builder = new WebHostBuilder()
.Configure(app =>
{
app.UseSession();
})
.ConfigureServices(services =>
{
services.AddSingleton<IDistributedCache, TestDistributedCache>();
services.AddSession();
});
using (var server = new TestServer(builder))
{
var client = server.CreateClient();
await client.GetAsync(string.Empty);
}
});
Assert.Equal("Error connecting database.", exception.Message);
}
[Fact] [Fact]
public async Task SessionKeys_AreCaseSensitive() public async Task SessionKeys_AreCaseSensitive()
{ {
@ -533,16 +506,6 @@ namespace Microsoft.AspNetCore.Session
private class TestDistributedCache : IDistributedCache private class TestDistributedCache : IDistributedCache
{ {
public void Connect()
{
throw new InvalidOperationException("Error connecting database.");
}
public Task ConnectAsync()
{
throw new InvalidOperationException("Error connecting database.");
}
public byte[] Get(string key) public byte[] Get(string key)
{ {
throw new NotImplementedException(); throw new NotImplementedException();