public override void OnStateChanged(UserState prev, UserState next)
 {
     if (_logger.IsEnabled(LogEventLevel.Debug))
     {
         var callingMethod = new StackTrace().GetFrame(2).GetMethod();
         _logger.Debug($"{prev.GetType().Name} --> {next.GetType().Name} : {callingMethod.Name}");
     }
 }
Esempio n. 2
0
        public static string GetDescription(this UserState value)
        {
            Type type  = value.GetType();
            var  filed = type.GetField(value.ToString());

            if (filed.IsDefined(typeof(DescriptionAttribute), true))
            {
                DescriptionAttribute description = (DescriptionAttribute)filed.GetCustomAttribute(typeof(DescriptionAttribute), true);
                return(description.Dscription);
            }
            else
            {
                return(value.ToString());
            }
        }