Exemplo n.º 1
0
        /// <summary>
        /// Loads the dimensions.
        /// </summary>
        private void Load()
        {
            if (Invalid)
            {
                IsInitialized = false;
            }

            if (!IsInitialized)
            {
                Collection        = new System.Collections.Generic.List <OlapDimension>(0);
                _accessCollection = new System.Collections.Generic.Dictionary <string, int>();

                System.Collections.Specialized.StringCollection dimensionNames = null;

                if (_cubeName != null)
                {
                    dimensionNames = NativeOlapApi.CubeDimensions(_server.Store.ClientSlot, _server.ServerHandle, _cubeName, _server.LastErrorInternal);
                }
                else
                {
                    dimensionNames = NativeOlapApi.Dimensions(_server.Store.ClientSlot, _server.ServerHandle, _server.LastErrorInternal);
                }

                if (dimensionNames != null)
                {
                    for (int i = 0; i < dimensionNames.Count; i++)
                    {
                        string dimname = dimensionNames[i];
                        Collection.Add(new OlapDimension(_server, dimname));
                        _accessCollection.Add(dimname.ToUpper(), i);
                    }
                }
                else
                {
                    if (_server.LastErrorInternal.Value != 0)
                    {
                        throw new OlapException("Receiving the dimension collection failed!", _server.LastErrorInternal.Value);
                    }
                }
                Invalid       = false;
                IsInitialized = true;
            }
        }