示例#1
0
        /// <summary>
        /// Populates a view model with content input queried from the Umbraco context
        /// </summary>
        /// <typeparam name="TModel">Type of model to populate</typeparam>
        /// <returns>View model instance</returns>
        public TModel Build <TModel>()
            where TModel : new()
        {
            var create  = new TModel();
            var handler = _handlerResolver.Resolve <TModel>();

            handler.Handle(create);
            return(create);
        }
示例#2
0
        public void Dispatch <T>() where T : ICommand
        {
            var handler = _resolver.Resolve <T>();

            if (handler != null)
            {
                handler.Handle();
            }
        }
示例#3
0
        public void Dispatch <T>(T command) where T : IPersonCommand
        {
            var handler = _resolver.Resolve <T>();

            if (handler != null)
            {
                handler.Handle(command);
            }
        }