コード例 #1
0
        protected ICommandBinder FindBinder(IComponent component)
        {
            ICommandBinder binder = null;
            var            type   = component.GetType();

            while (type != null)
            {
                binder = Binders.FirstOrDefault(x => x.SourceType == type);
                if (binder != null)
                {
                    return(binder);
                }

                type = type.BaseType;
            }

            if (binder == null)
            {
                throw new Exception($"No binding found for component of type {component.GetType().Name}");
            }

            return(binder);
        }