public async Task <IActionResult> Init(InitializeUiFlowRequest request) { using (_profiler.Profile(nameof(UiFlowController), nameof(Init))) { Logger.Trace(() => $"Starting - {nameof(Init)} --> {request} "); var result = await this.HandleActionAsync(async() => { var input = ControllerContext.RouteData.Values.ToExpandoObject(Request.Query); return(await _flowInitialViewResolver.Execute( new InitialViewRequest <IActionResult> { ContainerFlowHandler = request.ContainerFlowHandler, FlowInput = input.ToExpandoObject(), FlowType = ResolveFlowTypeFromValueOrUrl(request.FlowType), StartType = request.StartType, OnBuildView = async model => { var resolverRequest = new FlowResultResolverRequest <IActionResult> { ScreenModel = model }; AddDefaultCallbackHandlers(resolverRequest); return await _resultResolver.Execute(resolverRequest); } })); }); Logger.Trace(() => $"Completed - {nameof(Init)} --> {request} "); return(result); } }
public LoginRecord Get(long id) { return(_profiler.Profile( () => _readerDelegate.Get(id), $"function=[{MethodBase.GetCurrentMethod().Name}]; id=[{id}]; " )); }
public async Task <IActionResult> Resolve() { using (_profiler.Profile(nameof(DeferredComponentPartialsController), nameof(Resolve))) { var input = (IDictionary <string, object>)ControllerContext.RouteData.Values.ToExpandoObject(Request.Query, forceLowerCaseOfValues: false); var handlerComponent = ResolveHandler(input); var getFlowContext = _flowRepository.Get(input[nameof(UiFlowContextData.FlowHandler).ToLowerInvariant()].ToString()); var type = handlerComponent.GetType(); var invocationInfo = type.GetFastMethodInvocationHandler("InvokeDeferredAsync"); var componentInput = ((ExpandoObject)input).ToObjectOfType(invocationInfo.ArgumentTypes[1], false); var componentId = input[nameof(FlowComponentViewModel.ComponentId).ToLowerInvariant()].ToString(); var screenModel = (await getFlowContext).GetCurrentStepData <UiFlowScreenModel>(); var result = await invocationInfo.Execute <Task <IActionResult> >(handlerComponent, new object[] { componentId, componentInput, screenModel, (Func <string, object, IActionResult>)BuildView }); return(result); } IActionResult BuildView(string viewName, object model) { return(PartialView(viewName, model)); } }
public TEntity Get(long id) { var callerInfo = LoggingExtensions.Caller(); return(_profiler.Profile( () => _readerDelegate.Get(id), $"{callerInfo} - id=[{id}]" )); }
private async Task <int> CreateTask(IProfiler profiler, string name) { using (profiler.Profile(new ProfileOperationSpecification(name) { Category = "Test" })) { await Task.Delay(100); } return(42); }
public GraphicsWindow(IMessageBus bus, IObservableTimer timer, IGUI gui, IAssets assets, IProfiler profiler, ICamera camera) : base(1280, 720, new GraphicsMode(32, 0, 0, 4), "Sharp Engine") { _profiler = profiler; _camera = camera; _profile = _profiler.Profile("Graphics"); _timer = timer; _gui = gui; Bus = bus; Views = new ConcurrentDictionary<Guid, IGameObjectView>(); SetupGUI(); _assets = assets; foreach (var viewtype in AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany(s => s.GetTypes()).Where(p => typeof(IGameObjectView).IsAssignableFrom(p) && p.IsClass && p.IsDefined(typeof(BindViewAttribute), false)).ToList()) { var bindViewAttribute = viewtype.GetCustomAttributes(typeof(BindViewAttribute), true).Cast<BindViewAttribute>().FirstOrDefault(); if (bindViewAttribute != null) _availableViews.Add(bindViewAttribute.GameObjectType, viewtype); } Bus.OfType<GameObjectCreated>().Subscribe(OnGameObjectCreated); }