Esempio n. 1
0
        public ExchangeProvider(NameValueCollection settings)
        {
            var ninjectSettings = new NinjectSettings {
                LoadExtensions = false
            };

            _kernel = new StandardKernel(ninjectSettings, new AdapterModule());

            _kernel.Load(new XmlExtensionModule());
            _settings = _kernel.Get <AdapterSettings>();
            _settings.AppendSettings(settings);

            Directory.SetCurrentDirectory(_settings["BaseDirectoryPath"]);

            string scopesPath = String.Format("{0}Scopes.xml", _settings["XmlPath"]);

            _settings["ScopesPath"] = scopesPath;

            if (File.Exists(scopesPath))
            {
                _scopes = Utility.Read <ScopeProjects>(scopesPath);
            }
            else
            {
                _scopes = new ScopeProjects();
                Utility.Write <ScopeProjects>(_scopes, scopesPath);
            }

            _response            = new Response();
            _response.StatusList = new List <Status>();
            _kernel.Bind <Response>().ToConstant(_response);
            string relativePath = String.Format("{0}BindingConfiguration.Adapter.xml",
                                                _settings["XmlPath"]
                                                );
            string bindingConfigurationPath = Path.Combine(
                _settings["BaseDirectoryPath"],
                relativePath
                );

            _kernel.Load(bindingConfigurationPath);
            InitializeIdentity();
        }
Esempio n. 2
0
        public ScopeProjects GetScopes()
        {
            _logger.Debug("In AdapterRepository GetScopes");

            ScopeProjects obj = null;

            try
            {
                WebHttpClient client = CreateWebClient(_adapterServiceUri);
                obj = client.Get <ScopeProjects>("/scopes");

                _logger.Debug("Successfully called Adapter.");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
                throw;
                // throw ex;
            }

            return(obj);
        }