DataObject.DataObject(string name, string syntax) Constructor
.NET Standard 2.x
Initializes an instance of the DataObject object according to the syntax in the SRD file and specifies the name for the object.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public DataObject(string name, string syntax);
Parameters
name System.String
The name of the DataObject object.
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, specify the name for this instance, then create a DataStore based on this instance, and 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 Example2()
{
// 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("department", 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