DataStore.Create(IDwMeta dwMeta) Method
.NET Standard 2.x
Creates a DataStore object according to the IDwMeta
object.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public static IDataStore Create(IDwMeta dwMeta);
Parameters
dwMeta
DWNet.Data.IDwMeta
An IDwMeta object.
Returns
DWNet.Data.IDataStore
The new DataStore created based on the specified IDwMeta.
Examples
The following code example demonstrates how to create a DataStore using the SRD syntax and the retrieve data from the database.
using DWNet.Data;
using PowerScript.Bridge;
using System;
using System.IO;
namespace Appeon.ApiDoc.DataStoreExamples
{
public class CreateExample
{
private readonly SchoolContext _context;
public CreateExample(SchoolContext dataContext)
{
// Set 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
var dataStore = DataStore.Create(dataobject);
dataStore.DataContext = _context;
// Retrieves data
int row = dataStore.Retrieve();
Console.WriteLine($"Retrieve Count = {row}");
/*This code produces the following output:
Retrieve Count = 4
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x