예제 #1
0
        //Virtural List Implementation

        public async Task <Tuple <IEnumerable <xcuda_Supplementary_unit>, int> > LoadRange(int startIndex, int count, string exp, Dictionary <string, string> navExp, IEnumerable <string> includeLst = null)
        {
            var overallCount = 0;

            if (System.ComponentModel.LicenseManager.UsageMode == LicenseUsageMode.Designtime || exp == null || exp == "None")
            {
                return(new Tuple <IEnumerable <xcuda_Supplementary_unit>, int>(new List <xcuda_Supplementary_unit>().AsEnumerable(), overallCount));
            }

            try
            {
                using (var t = new xcuda_Supplementary_unitClient())
                {
                    IEnumerable <DTO.xcuda_Supplementary_unit> res = null;

                    res = await t.LoadRangeNav(startIndex, count, exp, navExp, includeLst).ConfigureAwait(continueOnCapturedContext: false);

                    overallCount = await t.CountNav(exp, navExp).ConfigureAwait(continueOnCapturedContext: false);



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