Beispiel #1
0
        protected virtual void SetProxy()
        {
            if (_proxy != null)
            {
                return;
            }
            var host        = ConfigurationManager.AppSettings["cfs:host"] ?? "localhost";
            var protocol    = ConfigurationManager.AppSettings["cfs:protocol"] ?? "net.tcp";
            var serviceName = ConfigurationManager.AppSettings["cfs:serviceName"] ?? "CubeDataService";

            if (protocol.Equals("net.tcp", StringComparison.OrdinalIgnoreCase))
            {
                _proxy = new NetTcpCubeDataServiceProxy(host);
            }
            else
            {
                _proxy = new NamedPipeCubeDataServiceProxy(serviceName);
            }
        }
Beispiel #2
0
        public virtual CubeData GetData()
        {
            ConstrainedViewId();
            if (string.IsNullOrWhiteSpace(ModuleName))
            {
                throw new ArgumentException("No view id is provided");
            }

            int viewId;

            if (!Int32.TryParse(ModuleName, out viewId))
            {
                throw new ArgumentException(string.Format("View Id must be an integer but provide '{0}'", ModuleName));
            }

            SetProxy();
            CubeData data = null;

            try
            {
                data = _proxy.GetCubeData(new CubeCommandInfo
                {
                    CommandText          = ModuleName,
                    CommandType          = CommandType.ViewId,
                    CubeConnectionString = ConnectionString,
                    DbConnectionString   = DbConnectionString,
                    Parameters           = GetCopyOfParameters(),
                    DataFormat           = GetDataFormat()
                });
            }
            catch (Exception ex)
            {
                _proxy = null;
                Logger.Error(ex.Message);
            }
            return(data);
        }