React to SessionCollectionExtensions renames
React to aspnet/HttpAbstractions#280
This commit is contained in:
parent
10f1b9c038
commit
d37f9dded2
|
|
@ -31,8 +31,8 @@ namespace SessionSample
|
||||||
subApp.Run(async context =>
|
subApp.Run(async context =>
|
||||||
{
|
{
|
||||||
int visits = 0;
|
int visits = 0;
|
||||||
visits = context.Session.GetInt("visits") ?? 0;
|
visits = context.Session.GetInt32("visits") ?? 0;
|
||||||
context.Session.SetInt("visits", ++visits);
|
context.Session.SetInt32("visits", ++visits);
|
||||||
await context.Response.WriteAsync("Counting: You have visited our page this many times: " + visits);
|
await context.Response.WriteAsync("Counting: You have visited our page this many times: " + visits);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -40,7 +40,7 @@ namespace SessionSample
|
||||||
app.Run(async context =>
|
app.Run(async context =>
|
||||||
{
|
{
|
||||||
int visits = 0;
|
int visits = 0;
|
||||||
visits = context.Session.GetInt("visits") ?? 0;
|
visits = context.Session.GetInt32("visits") ?? 0;
|
||||||
await context.Response.WriteAsync("<html><body>");
|
await context.Response.WriteAsync("<html><body>");
|
||||||
if (visits == 0)
|
if (visits == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -50,7 +50,7 @@ namespace SessionSample
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
context.Session.SetInt("visits", ++visits);
|
context.Session.SetInt32("visits", ++visits);
|
||||||
await context.Response.WriteAsync("Your session was located, you've visited the site this many times: " + visits);
|
await context.Response.WriteAsync("Your session was located, you've visited the site this many times: " + visits);
|
||||||
}
|
}
|
||||||
await context.Response.WriteAsync("</body></html>");
|
await context.Response.WriteAsync("</body></html>");
|
||||||
|
|
|
||||||
|
|
@ -75,14 +75,14 @@ namespace Microsoft.AspNet.Session
|
||||||
app.UseInMemorySession();
|
app.UseInMemorySession();
|
||||||
app.Run(context =>
|
app.Run(context =>
|
||||||
{
|
{
|
||||||
int? value = context.Session.GetInt("Key");
|
int? value = context.Session.GetInt32("Key");
|
||||||
if (context.Request.Path == new PathString("/first"))
|
if (context.Request.Path == new PathString("/first"))
|
||||||
{
|
{
|
||||||
Assert.False(value.HasValue);
|
Assert.False(value.HasValue);
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
Assert.True(value.HasValue);
|
Assert.True(value.HasValue);
|
||||||
context.Session.SetInt("Key", value.Value + 1);
|
context.Session.SetInt32("Key", value.Value + 1);
|
||||||
return context.Response.WriteAsync(value.Value.ToString());
|
return context.Response.WriteAsync(value.Value.ToString());
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -110,12 +110,12 @@ namespace Microsoft.AspNet.Session
|
||||||
app.UseInMemorySession();
|
app.UseInMemorySession();
|
||||||
app.Run(context =>
|
app.Run(context =>
|
||||||
{
|
{
|
||||||
int? value = context.Session.GetInt("Key");
|
int? value = context.Session.GetInt32("Key");
|
||||||
if (context.Request.Path == new PathString("/first"))
|
if (context.Request.Path == new PathString("/first"))
|
||||||
{
|
{
|
||||||
Assert.False(value.HasValue);
|
Assert.False(value.HasValue);
|
||||||
value = 0;
|
value = 0;
|
||||||
context.Session.SetInt("Key", 1);
|
context.Session.SetInt32("Key", 1);
|
||||||
}
|
}
|
||||||
else if (context.Request.Path == new PathString("/second"))
|
else if (context.Request.Path == new PathString("/second"))
|
||||||
{
|
{
|
||||||
|
|
@ -154,12 +154,12 @@ namespace Microsoft.AspNet.Session
|
||||||
app.UseInMemorySession();
|
app.UseInMemorySession();
|
||||||
app.Run(context =>
|
app.Run(context =>
|
||||||
{
|
{
|
||||||
int? value = context.Session.GetInt("Key");
|
int? value = context.Session.GetInt32("Key");
|
||||||
if (context.Request.Path == new PathString("/first"))
|
if (context.Request.Path == new PathString("/first"))
|
||||||
{
|
{
|
||||||
Assert.False(value.HasValue);
|
Assert.False(value.HasValue);
|
||||||
value = 0;
|
value = 0;
|
||||||
context.Session.SetInt("Key", 1);
|
context.Session.SetInt32("Key", 1);
|
||||||
}
|
}
|
||||||
else if (context.Request.Path == new PathString("/second"))
|
else if (context.Request.Path == new PathString("/second"))
|
||||||
{
|
{
|
||||||
|
|
@ -231,12 +231,12 @@ namespace Microsoft.AspNet.Session
|
||||||
});
|
});
|
||||||
app.Run(context =>
|
app.Run(context =>
|
||||||
{
|
{
|
||||||
int? value = context.Session.GetInt("Key");
|
int? value = context.Session.GetInt32("Key");
|
||||||
if (context.Request.Path == new PathString("/first"))
|
if (context.Request.Path == new PathString("/first"))
|
||||||
{
|
{
|
||||||
Assert.False(value.HasValue);
|
Assert.False(value.HasValue);
|
||||||
value = 1;
|
value = 1;
|
||||||
context.Session.SetInt("Key", 1);
|
context.Session.SetInt32("Key", 1);
|
||||||
}
|
}
|
||||||
else if (context.Request.Path == new PathString("/second"))
|
else if (context.Request.Path == new PathString("/second"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue