DataObject.DataObject(string syntax) Constructor
.NET Standard 2.x
Initializes an instance of the DataObject object according to the syntax in the SRD file.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public DataObject(string syntax);
Parameters
syntax
System.String
The syntax in the SRD file.
Examples
The following code example demonstrates how to create an instance of DataObject based on the SRD syntax, then create a DataStore based on this instance, and then retrieve data from the database.
using System;
using System.IO;
using DWNet.Data;
using PowerScript.Bridge;
using Appeon.ApiDoc.Models;
namespace Appeon.ApiDoc.DataObjectExamples
{
public class DataObjectExample
{
private readonly SchoolContext _context;
public DataObjectExample(SchoolContext dataContext)
{
// Sets Data Context
_context = dataContext;
}
public void Example1()
{
// Gets the SRD syntax
string path = "ExamplesClient.pbw/examplesclient.pbt/school.pbl/d_department.srd";
var syntax = File.ReadAllText(path);
// Creates a DataObject object using the SRD syntax
var dataobject = new DataObject(syntax);
// Creates a DataStore object using the DataObject object and DataContext object
var dataStore = DataStore.Create(dataobject, _context);
// Retrieves data
dataStore.Retrieve();
Console.WriteLine($"RowCount = {dataStore.RowCount}");
/*This code produces the following output:
RowCount = 4
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x