Exemplo n.º 1
0
        public void Request(RequestRunType runtype = RequestRunType.Default)
        {
            switch (runtype)
            {
            case RequestRunType.Default:
                DefaultContext <CommandType, bool> .Instance.Enter(this as CommandType);

                break;

            case RequestRunType.Background:
                var task = new Task(() => DefaultContext <CommandType, bool> .Instance.Enter(this as CommandType));
                task.Start();
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        public static ResultType Request <RequestType, ResultType>(this RequestType request, RequestRunType runtype = RequestRunType.Default)
            where RequestType : IHas <IRequestLogic <RequestType, ResultType> >
        {
            switch (runtype)
            {
            case RequestRunType.Default:
                DefaultContext <RequestType, ResultType> .Instance.Enter(request);

                break;

            case RequestRunType.Background:
                var task = new Task(() => DefaultContext <RequestType, ResultType> .Instance.Enter(request));
                task.Start();
                break;

            default:
                break;
            }
            return(request.Result());
        }