DataStore.Create(IDwMeta dwMeta, DataContext context) Method
.NET Standard 2.x
Creates a DataStore object according to the IDwMeta
object and specifies the DataContext
for the DataStore.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public static IDataStore Create(IDwMeta dwMeta, DataContext context);
Parameters
dwMeta
DWNet.Data.IDwMeta
An IDwMeta object.
context
SnapObjects.Data.DataContext
A DataContext
object which represents the entry to the database.
Returns
DWNet.Data.IDataStore
The new DataStore created based on the specified IDwMeta and DataContext.
Examples
The following code example demonstrates how to create a DataStore using the SRD syntax and the specified DataContext and then 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 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(syntax);
// Creates a DataStore object using the DataObject object and DataContext object
var dataStore = DataStore.Create(dataobject, _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