Example #1
0
        List <T> GetFullList <T>(GetListMethod <T> getList,
                                 int?chunk)
        {
            List <T> fullList = new List <T>();

            if (chunk > 0 || !chunk.HasValue)
            {
                string currentOffset = null;
                while (true)
                {
                    T[] portion = null;
                    currentOffset = getList(chunk, currentOffset, out portion);

                    if (portion != null)
                    {
                        fullList.AddRange(portion);
                    }
                    if (string.IsNullOrEmpty(currentOffset))
                    {
                        break;
                    }
                }
            }
            return(fullList);
        }
        protected DelegateListClassPropertyBase(string name, GetListMethod getList, CreateInstanceMethod createInstance) : base(name)
        {
            Assert.IsNotNull(getList);

            m_GetList        = getList;
            m_CreateInstance = createInstance ?? (c => default(TItem));
        }
Example #3
0
        public static List <T> GetFullList <T>(
            GetListMethod <T> getList,
            int?chunk,
            string itemName,
            AssertDelegate assert)
        {
            List <T> fullList = new List <T>();

            if (chunk > 0 || !chunk.HasValue)
            {
                string currentOffset = null;
                while (true)
                {
                    T[] portion = null;
                    currentOffset = getList(chunk, currentOffset, out portion);

                    if (portion != null)
                    {
                        if (chunk.HasValue)
                        {
                            assert(portion.Length <= chunk,
                                   string.Format("{0} {1}s returned", portion.Length, itemName),
                                   "Check that MaxLimit parameter is not exceeded",
                                   string.Empty);
                        }

                        fullList.AddRange(portion);
                    }
                    if (string.IsNullOrEmpty(currentOffset))
                    {
                        break;
                    }
                }
            }
            return(fullList);
        }
 public StructListStructProperty(string name, GetListMethod getList, CreateInstanceMethod createInstance = null) : base(name, getList, createInstance)
 {
 }
 protected DelegateListStructPropertyBase(string name, GetListMethod getList, CreateInstanceMethod createInstance) : base(name)
 {
     m_GetList        = getList;
     m_CreateInstance = createInstance ?? ((ref TContainer c) => default(TItem));
 }
 public ClassListClassProperty(string name, GetListMethod getList, CreateInstanceMethod createInstance = null) : base(name, getList, createInstance)
 {
 }