This commit is contained in:
@@ -42,7 +42,17 @@ public abstract class StatefullPage : Page
|
||||
/// </summary>
|
||||
protected async Task SaveState(PageContext ctx, CancellationToken ct)
|
||||
{
|
||||
foreach (var prop in GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance))
|
||||
var t = GetType();
|
||||
foreach (var prop in t.GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
|
||||
{
|
||||
var attr = prop.GetCustomAttribute<StatefullAttribute>();
|
||||
if (attr is null) continue;
|
||||
|
||||
var value = prop.GetValue(this);
|
||||
await ctx.StateStorage.SetAsync(ctx.SessionKey, attr.Key, value, ct);
|
||||
}
|
||||
|
||||
foreach (var prop in t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
|
||||
{
|
||||
var attr = prop.GetCustomAttribute<StatefullAttribute>();
|
||||
if (attr is null) continue;
|
||||
|
||||
Reference in New Issue
Block a user