Dictionary <string, string> GetDefaults()
        {
            var connections    = new Dictionary <string, string>();
            var uri            = new System.Uri(Path.Combine(Environment.ContentRootPath, "Data", "nwind.json"), System.UriKind.Relative);
            var dataConnection = new JsonDataConnection(new UriJsonSource(uri))
            {
                StoreConnectionNameOnly = true, Name = "Products (JSON)"
            };

            connections.Add(dataConnection.Name, dataConnection.CreateConnectionString());
            return(connections);
        }
        void IJsonConnectionStorageService.SaveConnection(string connectionName, JsonDataConnection dataConnection, bool saveCredentials)
        {
            var connections = GetConnections();

            if (connections == null)
            {
                return;
            }
            var connectionString = dataConnection.CreateConnectionString();

            if (connections.ContainsKey(connectionName))
            {
                connections[connectionName] = connectionString;
            }
            else
            {
                connections.Add(connectionName, connectionString);
            }
            UpdateSessionState(connections);
        }
    static string GetConnectionString(DataConnectionParametersBase connectionPars)
    {
        CustomStringConnectionParameters customConnectionPars = connectionPars as CustomStringConnectionParameters;

        if (customConnectionPars != null)
        {
            return(customConnectionPars.ConnectionString);
        }
        JsonSourceConnectionParameters jsonConnectionPars = connectionPars as JsonSourceConnectionParameters;

        if (jsonConnectionPars != null)
        {
            if (jsonConnectionPars.JsonSource == null)
            {
                throw new Exception();
            }
            JsonDataConnection jsonConnection = new JsonDataConnection(jsonConnectionPars.JsonSource);
            return(jsonConnection.CreateConnectionString());
        }
        throw new Exception();
    }