Skip to main content

IJsonDataConnectionProviderService.GetJsonDataConnection(String) Method

Gets a connection by name.

Namespace: DevExpress.DataAccess.Json

Assembly: DevExpress.DataAccess.v22.2.dll

NuGet Package: DevExpress.DataAccess


JsonDataConnection GetJsonDataConnection(
    string name


Name Type Description
name String

A connection name.


Type Description

A JSON connection.


The GetJsonDataConnection method resolves a connection name to a JSON connection.

The following code retrieves a connection string from the dictionary for the given connection name, and creates and returns the JsonDataConnection object.

using DevExpress.DataAccess.Json;
using DevExpress.DataAccess.Web;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System.Collections.Generic;
// ...
public class WebDocumentViewerJsonDataConnectionProvider : IJsonDataConnectionProviderService
    readonly Dictionary<string, string> jsonDataConnections;
    public WebDocumentViewerJsonDataConnectionProvider(Dictionary<string, string> jsonDataConnections)
        this.jsonDataConnections = jsonDataConnections;
    public JsonDataConnection GetJsonDataConnection(string name)
        if (jsonDataConnections == null)
            return null;
        return CustomDataSourceWizardJsonDataConnectionStorage.CreateJsonDataConnectionFromString(
            name, jsonDataConnections[name]);

For more information and code examples, review the following help topic: JSON Data - Register Connections.

See Also