public dynamic BuildDisplay(IContent content, string displayType, string groupId)
        {
            var contentKey = "ContentDisplay:" + content.Id.ToString();

            _profiler.StepStart(contentKey, String.Format("Content Display: {0} ({1})", content.Id, displayType));
            var result = _innerContentDisplay.BuildDisplay(content, displayType, groupId);

            _profiler.StepStop(contentKey);
            return(result);
        }
        public override void BuildDisplay(BuildDisplayContext context)
        {
            _drivers.Invoke(driver => {
                var key = "Driver:" + driver.GetType().FullName;
                _profiler.StepStart(key, String.Format("ContentPartDriver: {0}", driver.GetType().FullName));
                var result = driver.BuildDisplay(context);

                if (result != null)
                {
                    var key2 = "DriverApply:" + driver.GetType().FullName;
                    _profiler.StepStart(key2, String.Format("ApplyDriver", driver.GetType().FullName));
                    result.Apply(context);
                    _profiler.StepStop(key2);
                }

                _profiler.StepStop(key);
            }, Logger);
        }
Exemplo n.º 3
0
        public IEnumerable Notify(string messageName, IDictionary <string, object> eventData)
        {
            // NOTE: We can't profile everything because EventsInterceptor performs some work that's a bit harder to profile without forking or getting our
            // own interceptor working...
            _profiler.StepStart("EventBusNotify", "EventBus: " + messageName);
            // call ToArray to ensure evaluation has taken place
            var result = NotifyHandlers(messageName, eventData).ToArray();

            _profiler.StepStop("EventBusNotify");
            return(result);
        }
        private static bool TryInvokeMethod(IEventHandler eventHandler, Type interfaceType, string methodName, IDictionary<string, object> arguments, out IEnumerable returnValue, IProfilerService profiler) {
            MethodInfo method = _interfaceMethodsCache.GetOrAdd(String.Concat(eventHandler.GetType().Name + "_" + interfaceType.Name, "_", methodName, "_", String.Join("_", arguments.Keys)), GetMatchingMethod(eventHandler, interfaceType, methodName, arguments));

                if (method != null) {
                    var parameters = new List<object>();
                    foreach (var methodParameter in method.GetParameters()) {
                        parameters.Add(arguments[methodParameter.Name]);
                    }
                    var key= "EventBus:"+eventHandler.GetType().FullName +"."+ methodName;
                    profiler.StepStart(key,String.Format("EventBus: {0}",eventHandler.GetType().FullName +"."+ methodName),true);
                    var result = method.Invoke(eventHandler, parameters.ToArray());
                    profiler.StepStop(key);
                    returnValue = result as IEnumerable;
                    if (returnValue == null && result != null)
                        returnValue = new[] { result };
                    return true;
                }
                returnValue = null;
                return false;
            }