DataStoreDataExtensions.ExportRowAsJson(this IDataStoreBase dataStore, int row, DwBuffer dwBuffer = DwBuffer.Primary) Method
.NET Standard 2.x
Exports a row data from the specified buffer to a plain-format JSON string.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public static string ExportRowAsJson(this IDataStoreBase dataStore, int row,
DwBuffer dwBuffer = DwBuffer.Primary)
Parameters
row
System.Int32
The zero-based index number of the first row in the buffer that you want to export.
dwbuffer
DWNet.Data.DwBuffer
A value of the DwBuffer
enumerated datatype identifying the DataStore buffer
from which you want to export the data.
Returns
System.String
Returns the Json string if it succeeds.
Examples
The following code example demonstrates how to export a data row from the specified buffer to a JSON string.
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.DataStoreDataExtensionsExamples
{
public class ExportRowAsJsonExample
{
private readonly SchoolContext _context;
public ExportRowAsJsonExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
// Exports the first row of data from the primary buffer.
string json = datastore.ExportRowAsJson(0, DwBuffer.Primary);
Console.WriteLine(json);
/*This code produces the following output:
{"Departmentid":1,"Name":"Engineering","Budget":220000.0000,"Startdate":"2007-09-01T00:00:00","Administrator":2}
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x