コード例 #1
0
        public async Task <IEnumerable <OverShortSuggestedDocument> > OverShortSuggestedDocuments(List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return(new List <OverShortSuggestedDocument>().AsEnumerable());
            }
            try
            {
                using (var t = new OverShortSuggestedDocumentClient())
                {
                    var res = await t.GetOverShortSuggestedDocuments(includesLst).ConfigureAwait(continueOnCapturedContext: false);

                    if (res != null)
                    {
                        return(res.Select(x => new OverShortSuggestedDocument(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }
コード例 #2
0
        public async Task <IEnumerable <OverShortSuggestedDocument> > GetOverShortSuggestedDocumentsByExpressionNav(string exp, Dictionary <string, string> navExp, List <string> includesLst = null)
        {
            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || exp == null || exp == "None")
            {
                return(new List <OverShortSuggestedDocument>().AsEnumerable());
            }
            try
            {
                using (var t = new OverShortSuggestedDocumentClient())
                {
                    IEnumerable <DTO.OverShortSuggestedDocument> res = null;
                    if (exp == "All" && navExp.Count == 0)
                    {
                        res = await t.GetOverShortSuggestedDocuments(includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }
                    else
                    {
                        res = await t.GetOverShortSuggestedDocumentsByExpressionNav(exp, navExp, includesLst).ConfigureAwait(continueOnCapturedContext: false);
                    }

                    if (res != null)
                    {
                        return(res.Select(x => new OverShortSuggestedDocument(x)).AsEnumerable());
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (FaultException <ValidationFault> e)
            {
                throw new Exception(e.Detail.Message, e.InnerException);
            }
            catch (Exception)
            {
                Debugger.Break();
                throw;
            }
        }