Skip to content

An extension to read JSON from SQL server off of a SQLCommand to get data.

License

Notifications You must be signed in to change notification settings

CheetahChrome/SQLJSONReader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLJSONReader

An extension to read JSON from SQL server off of a SQLCommand to get data. This package is in Nuget as SQLJsonReader

Usage, include using SQLJSON.Extensions; for the use and addition of ExecuteJsonReaderAsync and ExecuteJsonReader to read JSON from SQL Server after a stored procedure call returns JSON using the for JSON.

string result;

using (SqlConnection conn = new SqlConnection(connection))
{
    conn.Open();

    using (var cmd = new SqlCommand(sproc, conn) { CommandType = CommandType.StoredProcedure, 
                                                   CommandTimeout = 600 })
    {
        if (parameters != null)
            cmd.Parameters.AddRange(parameters);

        var reader = await cmd.ExecuteJsonReaderAsync();

        result = await reader.ReadAllAsync();
    }
}

See also Json-Orm Nuget Package which uses this package to process its SQL Server derived json into models.

About

An extension to read JSON from SQL server off of a SQLCommand to get data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages