Ejemplo n.º 1
0
        /// <summary>
        /// Инициализирует новый экземпляр <see cref="Element"/>.
        /// </summary>
        /// <param name="context">Экземпляр контекста <see cref="BotContext"/>.</param>
        protected Element(BotContext context)
        {
            Context = Check.NotNull(context, nameof(context));
            _logger = Check.NotNull(context.Logger, nameof(context.Logger));

            var info = StackTraceHelper.GetInfo();

            ((IInterceptable)this).Info = info;
            LogName = info.FullName;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Инициализирует новый экземпляр <see cref="ElementCollection{TElement}"/>.
        /// </summary>
        /// <param name="context">Экземпляр контекста <see cref="BotContext"/>.</param>
        protected ElementCollection(BotContext context)
        {
            Context = Check.NotNull(context, nameof(context));
            _logger = Check.NotNull(Context.Logger, nameof(Context.Logger));

            _itemType = typeof(TElement);
            Check.ElementCollectionItem(_itemType, out var itemCtorParametersCount);

            _itemCtorParams    = new object[itemCtorParametersCount];
            _itemCtorParams[0] = Context;

            var info = StackTraceHelper.GetInfo();

            ((IInterceptable)this).Info = info;
            LogName = info.FullName;
        }