示例#1
0
        public static IEnumerable <CategoryEntity> GetCategoryList(string category = null)
        {
            if (_categoryList == null)
            {
                lock (_syncLockCategoryList)
                {
                    if (_categoryList == null)
                    {
                        _categoryList = TableStorageHelper.RetrieveAllAsync <CategoryEntity>(Constants.TABLE_CATEGORY).Result;

                        if (category != null)
                        {
                            return(_categoryList.Where(c => c.PartitionKey == category)); //returning here itself b/c of UpdateCategoryListCache method
                        }
                        else
                        {
                            return(_categoryList);
                        }
                    }
                }
            }

            if (category != null)
            {
                return(_categoryList.Where(c => c.PartitionKey == category));
            }
            else
            {
                return(_categoryList);
            }
        }
示例#2
0
        public static IEnumerable <UserEntity> GetUsers()
        {
            if (_users == null)
            {
                lock (_syncLockUsers)
                {
                    if (_users == null)
                    {
                        _users = TableStorageHelper.RetrieveAllAsync <UserEntity>(Constants.TABLE_USER).Result;
                        return(_users); //returning here itself b/c of UpdateTagListCache method
                    }
                }
            }

            return(_users);
        }
示例#3
0
        public static IEnumerable <TagEntity> GetTagList()
        {
            if (_tagList == null)
            {
                lock (_syncLockTagList)
                {
                    if (_tagList == null)
                    {
                        _tagList = TableStorageHelper.RetrieveAllAsync <TagEntity>(Constants.TABLE_TAG).Result;
                        return(_tagList); //returning here itself b/c of UpdateTagListCache method
                    }
                }
            }

            return(_tagList);
        }