IFormState OR attributes
All checks were successful
build nuget workflow for TelegramBotBase project / Build-TelegramBotBase (x64, linux) (push) Successful in 38s

This commit is contained in:
Максим Човнюк 2024-12-07 10:50:36 +05:00
parent 6a80ec66ad
commit 3f0fc962a4
2 changed files with 14 additions and 10 deletions

View File

@ -8,7 +8,7 @@ jobs:
Build-TelegramBotBase:
env:
APP_PROJECT_NAME: TelegramBotBase
PACKAGE_VERSION: "123.0.1"
PACKAGE_VERSION: "123.1.0"
strategy:
matrix:
os:

View File

@ -302,17 +302,21 @@ public class SessionManager
se.Values = ssea.Values;
}
//Search for public properties with SaveState attribute
var fields = form.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
.Where(a => a.GetCustomAttributes(typeof(SaveState), true).Length != 0).ToList();
foreach (var f in fields)
else
{
var val = f.GetValue(form);
se.Values.Add("$" + f.Name, val);
//Search for public properties with SaveState attribute
var fields = form.GetType()
.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
.Where(a => a.GetCustomAttributes(typeof(SaveState), true).Length != 0).ToList();
foreach (var f in fields)
{
var val = f.GetValue(form);
se.Values.Add("$" + f.Name, val);
}
}
states.Add(se);